OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.34k stars 6.46k forks source link

[BUG] Wrong DataType #12155

Closed devhl-labs closed 1 year ago

devhl-labs commented 2 years ago

The below code produces models with properties of data type List when the type should be List of type ClanWarAttack

Bug Report Checklist

OpenAPI declaration file content or url
openapi: 3.0.1
info:
  title: Clash of Clans API
  termsOfService: http://supercell.com/en/terms-of-service/
  version: v1
paths: {}
components:
  schemas:
    ClanWarMember:
      type: object
      properties:
        attacks:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/ClanWarAttackList'
    ClanWarAttackList:
      type: array
      items:
        $ref: '#/components/schemas/ClanWarAttack'
    ClanWarAttack:
      type: object
      properties:
        order:
          type: integer
spacether commented 2 years ago

What generator are you using?

devhl-labs commented 2 years ago

Csharp-netcore My generichost library has this issue patched, but a real fix should replace it. I think the patch is in a pr still though.

Edit - the hotfix is in my generic host fixes pr. This url is in a comment.

wing328 commented 1 year ago

I tested with the latest master with java client generator:

public class ClanWarMember {
  public static final String SERIALIZED_NAME_ATTACKS = "attacks";
  @SerializedName(SERIALIZED_NAME_ATTACKS)
  private List<ClanWarAttack> attacks;

The result looks good so I think we can close this one.