Skip to content

Show an error when the schema in discriminator mapping is undefined#11127

Merged
wing328 merged 1 commit intomasterfrom
better_discriminotor_check
Dec 15, 2021
Merged

Show an error when the schema in discriminator mapping is undefined#11127
wing328 merged 1 commit intomasterfrom
better_discriminotor_check

Conversation

@wing328
Copy link
Copy Markdown
Member

@wing328 wing328 commented Dec 15, 2021

Show error when schema in discriminator mapping in oneOf/anyOf is undefined, e.g.

[main] INFO  o.o.c.languages.AbstractJavaCodegen - NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).
[main] INFO  o.o.c.languages.AbstractJavaCodegen - Processing operation getState
[main] INFO  o.o.c.languages.AbstractJavaCodegen - Processing operation createState
[main] ERROR o.o.codegen.DefaultCodegen - Failed to lookup the schema 'ObjC' when processing the discriminator mapping of oneOf/anyOf. Please check to ensure it's defined properly.
[main] ERROR o.o.codegen.DefaultCodegen - Failed to lookup the schema 'ObjC' when processing the discriminator mapping of oneOf/anyOf. Please check to ensure it's defined properly.
[main] WARN  o.o.codegen.DefaultCodegen - 'CustomOneOfSchema' defines discriminator 'realtype', but the referenced schema 'ObjA' is incorrect. invalid optional definition of realtype, include it in required
[main] WARN  o.o.codegen.DefaultCodegen - 'CustomOneOfSchema' defines discriminator 'realtype', but the referenced schema 'ObjB' is incorrect. invalid optional definition of realtype, include it in required

(ideally this should be done in the parser. will try to submit a PR upstream later)

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*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (5.3.0), 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

cc @OpenAPITools/generator-core-team

@wing328 wing328 added this to the 5.3.1 milestone Dec 15, 2021
@wing328 wing328 changed the title Show error when schema in discriminator mapping is undefined Show an error when the schema in discriminator mapping is undefined Dec 15, 2021
@wing328 wing328 merged commit c27ddc6 into master Dec 15, 2021
@wing328 wing328 deleted the better_discriminotor_check branch December 15, 2021 14:26
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.

1 participant