We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The below OpenAPI spec leads to the following Python code block in ModelWithDict.to_dict():
ModelWithDict.to_dict()
dict_property: Optional[Dict[str, conlist(StrictStr)]] = Field(None, alias="dictProperty") ... _field_dict_of_array = {} if self.dict_property: for _key in self.dict_property: if self.dict_property[_key]: _field_dict_of_array[_key] = [ _item.to_dict() for _item in self.dict_property[_key] ] _dict['dictProperty'] = _field_dict_of_array
This has two errors:
.to_dict()
if self.dict_property[_key]:
7.0.1
openapi: 3.0.1 info: title: "" version: "" paths: {} components: schemas: ModelWithDict: type: object properties: dictProperty: type: object additionalProperties: type: array items: type: string
The text was updated successfully, but these errors were encountered:
Fix unnamed dicts with additional properties
d2812bc
Closes OpenAPITools#16630
[python] Fix unnamed dicts with additional properties (#16779)
f180aa0
* test: Add two extra models for testing * Fix unnamed dicts with additional properties Closes #16630
Successfully merging a pull request may close this issue.
Bug Report Checklist
Description
The below OpenAPI spec leads to the following Python code block in
ModelWithDict.to_dict()
:This has two errors:
.to_dict()
is called on the list items, which fails because they are strings.if self.dict_property[_key]:
wrongly skips dictionary keys where the value is an empty list.openapi-generator version
7.0.1
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered: