[BUG] CodegenParameter.baseType is different than CodegenProperty.baseType
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?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When generating specs with a container type, the behavior of CodegenParameter
and CodegenProperty
is inconsistent.
- in
CodegenParameter
thebaseType
refers to theitems
type - in
CodegenProperty
thebaseType
refers to the container type (the correct behavior)
e.g. generating modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
with any generator (tested with csharp
and dart-dio-next
)
- operation
createUsersWithArrayInput
has array ofUser
as body parameter when debugging this:"bodyParam" : { "dataType" : "BuiltList<User>", "baseType" : "User", ... }
- Model
NullableClass
has propertyarray_nullable_prop
which is a list of objects when debugging this:{ "dataType" : "BuiltList<JsonObject>", "datatypeWithEnum" : "BuiltList<JsonObject>", "baseType" : "BuiltList", ... }
openapi-generator version
5.2.1 (latest master commit a7de7095a7bfb6f84f8a7115b009db612db24a26)
Generation Details
for dart-dio-next
: ./bin/generate-samples.sh bin/configs/dart-dio-next* -- --global-property debugOperations,debugModels > log.txt
for csharp
: ./bin/generate-samples.sh bin/configs/other/openapi3/csharp-OpenAPIClientNetStandard.yaml -- --global-property debugOperations,debugModels > log_cs.txt
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
io.swagger.codegen.languages.DefaultCodegenConfig ...
Go to download ... CodegenParameter; import io.swagger.codegen. ... baseType, toEnumName(baseItem)); // naming the enum with respect to the language enum ...
Read more >modules/openapi-generator/src/main/java/org/openapitools ...
baseType = getSchemaType(p); // this can cause issues for clients which don't support enums if (property.isEnum) { property.
Read more >CodegenParameter (swagger-codegen (core library) 2.4.1 API)
public class CodegenParameter extends Object ... Methods inherited from class java.lang. ... baseType. public String baseType ...
Read more >io.swagger.codegen.languages.ElixirClientCodegen.java ...
if you want to create one template for file, you can do so here. * for multiple files for model, just put another...
Read more >openapi-generator / - src / - main / - java / - org - Program Talk
Learn how to use api ... may not be properly formatted by uncrustify (0.66 or later) or other code formatter. To ... baseType;...
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
yes, the problem is there is no way to get the list type alone in the operation parameters
Yea, not sure where this is handled. You can try to rewrite the
baseType
similar to the handling here: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioNextClientCodegen.java#L294All the information needed (container type, unique items) should be available.