-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[python-experimental] Minor doc update, code comments and exception handling #5945
Merged
spacether
merged 7 commits into
OpenAPITools:master
from
CiscoM31:python-experimental-any-type
Apr 24, 2020
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4e1dba5
add support for any type, i.e. when 'type' attribute is not specified…
sebastien-rosset 7fb2602
fix typos, add code comments
sebastien-rosset 78f71ba
Handle case when 'type' attribute is not present in the OAS schema
sebastien-rosset 43eecab
fix python formatting rule
sebastien-rosset 332d5f5
fix python formatting rule
sebastien-rosset bc46963
remove 'object' as a type
sebastien-rosset 025d87d
Merge branch 'master' of github.com:CiscoM31/openapi-generator into p…
sebastien-rosset 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 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
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.
@sebastien-rosset can we discuss this over Skype?
I am concerned with doing it this way because many python classes inherit from the object type. So if we did it this way, it would allow in a ton of other class instances that we shouldn't like set, tuple, and arbitrary other classes.
Swagger/Openapi only allows specific types (string, int, float, dict, list, bytes, datetime, date, file_type, none_type)
My preference would be to instead convert these any type classes in python into a composed schema where it oneOf allows any type. As an added benefit, this could maybe be used to verify that we can have oneOf models with simple or complex types, which I'm not sure we can do.
Things like:
oneOf:
What do you think?
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.
Yes I think that makes sense. Currently, when the type is "any", the generated openapi_types() function has a dict of properties to set of allowed types, and the allowed type is "object". That currently causes a runtime exception. So instead of having "object" in the list, we would enumerate all possible types: str, bool, date, datetime, dict, float, int, list