Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [CORE] Don't have the inline model resolver extract composed schemas #5230

Closed
3 of 6 tasks
spacether opened this issue Feb 6, 2020 · 1 comment
Closed
3 of 6 tasks

Comments

@spacether
Copy link
Contributor

spacether commented Feb 6, 2020

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Per our conversation in #4906
When parsing a composed schema, the inline model resolver should not extract composed schemas per the Openapi spec:

Specifically, the spec at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#discriminator-object says:

When using the discriminator, inline schemas will not be considered.

openapi-generator version

master branch

OpenAPI declaration file content or url
    FruitInlineDisc:
      oneOf:
        - type: object
          required:
            - seeds
            - fruitType
          properties:
            seeds:
              type: integer
            fruitType:
              type: string
        - type: object
          required:
            - length
            - fruitType
          properties:
            length:
              type: integer
            fruitType:
              type: string
      discriminator:
        propertyName: fruitType
Command line used for generation

use the python generator with this spec

Steps to reproduce

Debug the models and you will see that new models are created from the composed inline schemas. They should not be extracted.

Related issues/PRs

#4906

Suggest a fix

Don't extract the inline schemas when a composed schema has a discriminator

@spacether spacether changed the title [BUG] [CORE] DO not have the inline model resolver extract composed schemas [BUG] [CORE] Don't have the inline model resolver extract composed schemas Feb 6, 2020
@spacether
Copy link
Contributor Author

Closing this because there are more important tickets to work on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant