-
Notifications
You must be signed in to change notification settings - Fork 3k
OpenAPI: Fix additionalProperties for SnapshotSummary #9838
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
Conversation
|
Can you do make generate to have python code update as well? Otherwise LGTM |
@dramaticlly Tested with OpenAPI's python generator (if that's what you mean), details also in the issue #9837. Though you'll need to scroll a bit down to see that. |
Can you check if your workspace is empty after generate? I think it will update the python file and you need that as part of your commit. You can see pull request build also failed for the same reason |
edb67af to
f4804aa
Compare
|
|
||
| class Summary(BaseModel): | ||
| operation: Literal['append', 'replace', 'overwrite', 'delete'] | ||
| additionalProperties: Optional[str] = None |
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.
I would have expected the summary to also have Optional[Dict[str, str]] = None
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.
When I used the plain OpenAPI generator (tested on 6.6.0 & 7.0.0) to generate python code, this is what I got
...
class SnapshotSummary(BaseModel):
"""
SnapshotSummary
"""
operation: StrictStr = Field(...)
additional_properties: Dict[str, Any] = {}
__properties = ["operation"]
...
Which is closer to what you suggested above. I guess the code generation process here might leverage some different library.
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.
So every generator is different. I don't think this is supported by the one we use right now. But I think the change in the yaml is correct 👍
| enum: ["append", "replace", "overwrite", "delete"] | ||
| additionalProperties: | ||
| type: string | ||
| additionalProperties: |
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.
this change LGTM and also conforms to https://swagger.io/docs/specification/data-models/dictionaries/
nastra
left a comment
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.
LGTM, @Fokko could you please take a look at the generated python code?
Fokko
left a comment
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.
Looks good. Thanks @haizhou-zhao for working on this, and @nastra for the review 👍
|
|
||
| class Summary(BaseModel): | ||
| operation: Literal['append', 'replace', 'overwrite', 'delete'] | ||
| additionalProperties: Optional[str] = None |
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.
So every generator is different. I don't think this is supported by the one we use right now. But I think the change in the yaml is correct 👍
* [ISSUE-9837] Correct additionalProperties for SnapshotSummary Model * Include minimal change to generated python files --------- Co-authored-by: Haizhou Zhao <haizhou_zhao@apple.com> Co-authored-by: Steve Zhang <hongyue_zhang@apple.com>
* [ISSUE-9837] Correct additionalProperties for SnapshotSummary Model * Include minimal change to generated python files --------- Co-authored-by: Haizhou Zhao <haizhou_zhao@apple.com> Co-authored-by: Steve Zhang <hongyue_zhang@apple.com>
Details described on #9837