OpenAPI: Fix additionalProperties for SnapshotSummary#9838
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.
I would have expected the summary to also have Optional[Dict[str, str]] = None
There was a problem hiding this comment.
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.
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.
this change LGTM and also conforms to https://swagger.io/docs/specification/data-models/dictionaries/
Fokko
left a comment
There was a problem hiding this comment.
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.
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 <[email protected]> Co-authored-by: Steve Zhang <[email protected]>
* [ISSUE-9837] Correct additionalProperties for SnapshotSummary Model * Include minimal change to generated python files --------- Co-authored-by: Haizhou Zhao <[email protected]> Co-authored-by: Steve Zhang <[email protected]>
Details described on #9837