[BUG][Python] deepObject parameter style creates invalid code on 5.0.1 and raises exception on 5.1.1
See original GitHub issueBug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- 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?
Description
when having a spec with deep objects parameter style, the python codegen creates invalid code on generator 5.0.x
and fails altogether on generator 5.1.x
on 5.0.x
the bad code generated looks like
api_50/api/hosts_api.py:from api_50.model.str_bool_date_datetime_dict_float_int_list_str_none_type import StrBoolDateDatetimeDictFloatIntListStrNoneType
on 5.1.x
even considering them triggers
[main] ERROR o.o.codegen.DefaultCodegen - Undefined property/schema for `filter`. Default to type:string.
[main] ERROR o.o.codegen.DefaultCodegen - Undefined property/schema for `filter`. Default to type:string.
Exception in thread "main" java.lang.RuntimeException: Could not process operation:
openapi-generator version
5.1.1
5.0.1
OpenAPI declaration file content or url
relevant item is a used
components:
parameters:
filter_param:
in: query
name: filter
required: false
style: deepObject
explode: true
schema:
type: object
Generation Details/ steps to reproduce
Related issues/PRs
i haven’t found anything quite related
Suggest a fix
my current workaround is to use 5.1.x templates , the 5.0.x codegen and to post-process the generated files dropping the bad lines
it would be nice if there was a configuration option to set a deep_object_hook
so users can provide a own serialization/de-serialization for deep_objects
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
swagger-ui docker image: Help understanding why query ...
I'm trying to define OpenAPI for a query parameter that uses a simple type for a deepObject. According ...
Read more >Common Errors - AWS SimSpace Weaver
InternalFailure. The request processing has failed because of an unknown error, exception or failure. HTTP Status Code: 500. InvalidAction.
Read more >OpenApiSpex.Parameter — open_api_spex v3.16.0 - HexDocs
Parameter Object. Describes a single operation parameter. A unique parameter is defined by a combination of a name and location.
Read more >Model Binding in ASP.NET Core | Microsoft Learn
When the page is redisplayed by the preceding code, the invalid input isn't shown in the form field. This is because the model...
Read more >SQL Exception and Warning Messages - SAP Help Portal
See Installing Stored Procedures in the SAP jConnect for JDBC Installation Guide . 010P4. An output parameter was received and ignored. Description: The...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t mind updating the template, but I don’t have an environment to fix the exception being thrown:
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java#L440
@kevinkirkup my PR will fix the NPE issue but does not add the deep object serialization