You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When setting disallowAdditionalPropertiesIfNotPresent tofalse it generates models with missing imports, disallowing generating the models without manual edits.
Here's snippet from the code
from __future__ importannotationsimportpprintimportre# noqa: F401importjson# ------------------------------------------------------# Here should be: from typing import Any, Dict, Optional# ------------------------------------------------------fromtypingimportOptionalfrompydanticimportBaseModel, Field, StrictBoolclassObject(BaseModel):
""" Minimal object """var_property: Optional[StrictBool] =Field(False, alias="property", description="Property")
additional_properties: Dict[str, **Any] = {}
__properties= ["property"]
...
Just generate the code from the minimal example and the file ./out/python/openapi_client/models/object.py will be missing imports from Typing, explicitly from typing import Any, Dict
Related issues/PRs
Didn't find any
Suggest a fix
Add the imports if the property disallowAdditionalPropertiesIfNotPresent is set to false.
The text was updated successfully, but these errors were encountered:
Bug Report Checklist
Description
When setting
disallowAdditionalPropertiesIfNotPresent
tofalse
it generates models with missing imports, disallowing generating the models without manual edits.Here's snippet from the code
openapi-generator version
Latest docker image
OpenAPI declaration file content or url
Minimal example
Generation Details
The code was generated by following command:
That should translate to
Steps to reproduce
Just generate the code from the minimal example and the file
./out/python/openapi_client/models/object.py
will be missing imports fromTyping
, explicitlyfrom typing import Any, Dict
Related issues/PRs
Didn't find any
Suggest a fix
Add the imports if the property
disallowAdditionalPropertiesIfNotPresent
is set tofalse
.The text was updated successfully, but these errors were encountered: