-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When generating a client for the Pinterest API using their openapi spec, I get weird html encoded text in the generated pydantic model. I have managed to narrow it down to the default values for enum parameters
openapi-generator version
openapi-generator-cli version 7.15.0
OpenAPI declaration file content or url
https://gist.github.com/pergardebrink/ddebb6d358763e823cf851571b73c950
Generation Details
Python: version 3.12
Install openapi-generator-cli and run the following command:
openapi-generator-cli generate -g python -o ./generated -i ./openapi.yaml
Steps to reproduce
By running the command above, the ads_analytics_post_request.py will have multiple errors.
- report_format instance variable (line 30) is initialized using a string instead of the enum:
report_format: Optional[DataOutputFormat] = 'JSON'
- The from_dict method has a syntax error in the model_validate call (line 84):
_obj = cls.model_validate({
"report_format": obj.get("report_format") if obj.get("report_format") is not None else 'JSON'
})
return _obj
Related issues/PRs
This looks related, but not the same: #15685
Suggest a fix
I haven't looked through the codebase enough to understand exactly where the problem happens.
Reactions are currently unavailable