-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Recursively search for types during import type collection in deeply nested schemas #11221
Merged
spacether
merged 14 commits into
OpenAPITools:master
from
eak24:11220_nested_type_imports
Jan 14, 2022
Merged
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
12768ab
recursively search for types during import type collection in deeply …
eak24 3910036
composed schema recursive type import handling
eak24 039e3e2
change Importable to ComplexType to modularize related type-wrangling.
eak24 3613d54
Problems...
eak24 61263ff
Revert "Problems..."
eak24 96a6ecd
Reverted attempts to reuse recursive type-finding code.
eak24 ff4f9eb
add javadoc comments
eak24 68ec26e
fix javadoc warning.
eak24 005b382
fix NPE
eak24 9aeee78
PR feedback incorporation
eak24 5dd54d0
Include additionalProperties recursion.
eak24 0181fdd
More feedback
eak24 0a9d5b9
More feedback
eak24 404e5b4
Add comments from feedback
eak24 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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 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 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 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 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 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
32 changes: 32 additions & 0 deletions
32
modules/openapi-generator/src/test/resources/3_0/additional-properties-deeply-nested.yaml
This file contains 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,32 @@ | ||
openapi: 3.0.1 | ||
info: | ||
title: Test additional properties with ref | ||
version: '1.0' | ||
servers: | ||
- url: 'http://localhost:8000/' | ||
paths: | ||
/ping: | ||
post: | ||
operationId: pingGet | ||
responses: | ||
default: | ||
description: default response | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
additionalProperties: | ||
type: object | ||
additionalProperties: | ||
type: object | ||
additionalProperties: | ||
"$ref": "#/components/schemas/Person" | ||
components: | ||
schemas: | ||
Person: | ||
type: object | ||
properties: | ||
lastName: | ||
type: string | ||
firstName: | ||
type: string |
This file contains 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
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.
Why are we not accepting container type imports here?
objects can be sent in parameters and properties of those objects can $ref to other models
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.
If I leave this as true, 130 sample files are changed to include List, Set and Map-like imports that were already defined. This is because there seems to be an assumption to include such standard imports in the mustache templates already, and for some reason the duplicates aren't 'known about' in the codegen code. So I opted to optionally refrain from collecting those types. This could be changed later but for now is at least most consisten with what already is happening.