Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #8605
Closed
Open
Issue created Feb 03, 2021 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][PYTHON] inline response types generate invalid code referring to UNKNOWNBASETYPE

Created by: RonnyPfannschmidt

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

using inline responses can generate unknown base types resulting in bad docs on 4.3.0 and bad code on 5.0.x

openapi-generator version

5.0.1 snapshot, 5.0, master

OpenAPI declaration file content or url

https://gist.github.com/RonnyPfannschmidt/71a7d9bc344be968f0fed5559b5ee502#file-apispec-json

Generation Details
docker run --rm --volume "${PWD}":/local:z \
    openapitools/openapi-generator-cli generate \
    -i /local/apispec.json \
    -g python \
    -o /local/package

and for comparison with 4.3.1


docker run --rm --volume "${PWD}":/local:z \
    openapitools/openapi-generator-cli:v4.3.1 generate \
    -i /local/apispec.json \
    -g python \
    -o /local/package
Steps to reproduce
$ ag UNKNOWNBASETYPE package/
package/openapi_client/api/example_api.py
25:from openapi_client.model.unknownbasetype import UNKNOWNBASETYPE

package/docs/ExampleApi.md
24:from openapi_client.model.unknownbasetype import UNKNOWNBASETYPE

package/README.md
54:from openapi_client.model.unknownbasetype import UNKNOWNBASETYPE

and on v4.3.1

$ ag UNKN package/
package/openapi_client/api/example_api.py
50:        :param UNKNOWN_BASE_TYPE unknown_base_type:
76:        :param UNKNOWN_BASE_TYPE unknown_base_type:

package/README.md
68:unknown_base_type = openapi_client.UNKNOWN_BASE_TYPE() # UNKNOWN_BASE_TYPE |  (optional)

package/docs/ExampleApi.md
37:unknown_base_type = openapi_client.UNKNOWN_BASE_TYPE() # UNKNOWN_BASE_TYPE |  (optional)
52: **unknown_base_type** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)|  | [optional] 
Related issues/PRs
Suggest a fix

My understanding is that a inline type should be generated for inline responses, i would expect either a creation/usage of a inline type or an error suggesting extraction of the schema

depending on how hard this is, schema validators should also report this as warning/issue

a in-spec solution is to extract inline schemas to explicit schemas

Assignee
Assign to
Time tracking