Skip to content

[BUG] CodegenParameter.baseType is different than CodegenProperty.baseType #10189

@ahmednfwela

Description

@ahmednfwela

Bug 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 the baseType refers to the items type
  • in CodegenProperty the baseType 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 of User as body parameter
    when debugging this:
    "bodyParam" : {
          "dataType" : "BuiltList<User>",
          "baseType" : "User",
    ...
    }
    
  • Model NullableClass has property array_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 a7de709)

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

cc @wing328 @kuhnroyal @agilob

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions