We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Parsing should fail when required fields are not present in input.
Generated code with jaxrs-spec / jackson accepts json with missing required fields.
For this to work with jackson, the following are needed:
See sections 2.1 and 2.2 of this doc: https://www.novixys.com/blog/jackson-annotations-guide/#21_Confusion_with_required / https://www.novixys.com/blog/jackson-annotations-guide/#22_JsonProperty_and_JsonCreator
7.9.0-SNAPSHOT
This is not a regression as far as I can tell
If you post the code inline, please wrap it with
openapi: 3.0.0 info: title: Test version: '1.0' paths: '/test': get: requestBody: content: application/vnd.amadeus+json: schema: type: object title: TestObject required: - id properties: id: type: string responses: '200': description: OK
Here TestObject.id is a required field
java -jar openapi-generator-cli.jar generate -o ./generated -i ./test-api.yaml -g jaxrs-spec --additional-properties=generateBuilders=true,serializationLibrary=jackson
Save the API declaration in a file and generate it.
Deserializing empty json with generated code does not fail
objectMapper.readValue("{}", TestObject.class)
This code is supposed to thow MismatchedInputException since we didnt give "id" property in input.
No, but other generators like "java" generate code with JsonCreator / JsonProperty
I will submit a PR with the template override with use for pojo.mustache
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Bug Report Checklist
Description
Parsing should fail when required fields are not present in input.
Generated code with jaxrs-spec / jackson accepts json with missing required fields.
For this to work with jackson, the following are needed:
See sections 2.1 and 2.2 of this doc: https://www.novixys.com/blog/jackson-annotations-guide/#21_Confusion_with_required / https://www.novixys.com/blog/jackson-annotations-guide/#22_JsonProperty_and_JsonCreator
openapi-generator version
7.9.0-SNAPSHOT
This is not a regression as far as I can tell
OpenAPI declaration file content or url
If you post the code inline, please wrap it with
Here TestObject.id is a required field
Generation Details
java -jar openapi-generator-cli.jar generate -o ./generated -i ./test-api.yaml -g jaxrs-spec --additional-properties=generateBuilders=true,serializationLibrary=jackson
Steps to reproduce
Save the API declaration in a file and generate it.
Deserializing empty json with generated code does not fail
This code is supposed to thow MismatchedInputException since we didnt give "id" property in input.
Related issues/PRs
No, but other generators like "java" generate code with JsonCreator / JsonProperty
Suggest a fix
I will submit a PR with the template override with use for pojo.mustache
The text was updated successfully, but these errors were encountered: