-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Fix issue 21680 type other than object with properties #21817
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
Open
galamome
wants to merge
2
commits into
OpenAPITools:master
Choose a base branch
from
galamome:fix_issue_21680_type_other_than_object_with_properties
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+96
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
modules/openapi-generator/src/test/resources/3_0/issue_21680_array_with_properties.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
# Corresponds to bug report 21680: https://github.com/openapitools/openapi-generator/issues/21680 | ||
openapi: 3.0.1 | ||
info: | ||
title: API that has problem with OpenAPI Generator | ||
version: 1.0.0 | ||
paths: | ||
"/forbiddenaccesscsrf": | ||
get: | ||
summary: Forbidden access CSRF | ||
operationId: forbiddenAccessCsrfGet | ||
responses: | ||
'403': | ||
description: Expected response | ||
content: | ||
application/json: | ||
schema: | ||
"$ref": "#/components/schemas/errors" | ||
components: | ||
schemas: | ||
error: | ||
required: | ||
- code | ||
- horodatage | ||
- message | ||
type: object | ||
properties: | ||
code: | ||
type: string | ||
description: Short error description | ||
message: | ||
type: string | ||
description: Complete human readable description | ||
error_uri: | ||
type: string | ||
description: Detailed error description URI | ||
format: uri | ||
horodatage: | ||
type: string | ||
description: Date time of occurence | ||
format: date-time | ||
errors: | ||
type: array | ||
properties: | ||
empty: | ||
type: boolean | ||
items: | ||
"$ref": "#/components/schemas/error" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the PR
what about automatically fixing it in inline model resolver instead?
so that we can avoid another normalizer rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
I don't have an opinion about where the normalisation should be done. Mattias-Sehlstedt commented in the bug report, and advised to put it in the normalizer since it solves an oddity.
My thought was to leave the possibility to opt in to apply the normalizer rule and remove this oddity.
Maybe in order to avoid to create another normalizer rule, I could modify my PR in order to leave it in the normalizer but make it default. The drawback is that we would loose the possibility to opt out (and keep the "properties" attribute for a schema other than object, which is the oddity).
Do you think that would fit ?
By the way, I think "additionalProperties" attribute also should be removed for a schema other than object. At least it is what
modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java
says.Looking forward to solve this bug, thanks to your advice,
Guillaume