Skip to content

Issue 16394: Fix uncompileable java client code from composed schema - #16478

Open
adam-sickmiller-collibra wants to merge 1 commit into
OpenAPITools:masterfrom
adam-sickmiller-collibra:issue-16934
Open

adam-sickmiller-collibra wants to merge 1 commit into
OpenAPITools:masterfrom
adam-sickmiller-collibra:issue-16934

Conversation

@adam-sickmiller-collibra

@adam-sickmiller-collibra adam-sickmiller-collibra commented Sep 1, 2023 •

Copy link
Copy Markdown

This changes addresses the bug of the Java client generating uncompilable code described in this issue. This bug occurs when (1) A composed schema is used (2) The all of parent has a discriminator property that is an enum and (3) Default settings are used for the library configuration property, i.e., okhttp-gson, the default, is used.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.

-- Note: No changes after running scripts --
For Windows users, please run the script in Git BASH.

  • In case you are adding a new generator, run the following additional script :
    ./bin/utils/ensure-up-to-date
    
    Commit all changed files.
  • File the PR against the correct branch: master (7.0.1 - patch release), 7.1.x (minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@adam-sickmiller-collibra

Copy link
Copy Markdown
Author

@martin-mfg

Copy link
Copy Markdown
Contributor

Hi, thanks for your PR!

I'm not a maintainer, so I can't merge your PR, but allow me to point out two things anyway:

  • You are using getModelNameToSchemaCache().values(), which returns all(?) models, including models that are not related to the current discriminator. This can lead to wrong results. e.g. with this input spec. Instead, there should be a way to iterate only over the models inherited by the current ComposedSchema.
  • I'd recommend cleaning up the code changes a bit. i.e. removing the "---" at the beginning of the yaml file and the multiple consecutive newlines.

Thank you again for your contribution :-)

@wing328 wing328 modified the milestones: 7.0.1, 7.1.0 Sep 19, 2023
@wing328 wing328 modified the milestones: 7.1.0, 7.2.0 Nov 13, 2023
@wing328 wing328 modified the milestones: 7.2.0, 7.3.0 Dec 22, 2023
@wing328 wing328 modified the milestones: 7.3.0, 7.4.0 Feb 8, 2024
@wing328 wing328 modified the milestones: 7.4.0, 7.5.0 Mar 11, 2024
@wing328 wing328 modified the milestones: 7.5.0, 7.6.0 Apr 17, 2024

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants