yonaskolb / SwagGen

OpenAPI/Swagger 3.0 Parser and Swift code generator
MIT License
626 stars 147 forks source link

[Bug?] SwagGen@4.3.1 not using Models' entity in response #251

Open cfiken opened 4 years ago

cfiken commented 4 years ago

Hi @yonaskolb. When I upgrade SwagGen from 4.2.0 to 4.3.1, I noticed that there are big differences in API.{API_NAME}.Response. I made a reproducible repository and sample definition of openapi.yml.

In v4.2.0, the type of Response is SampleResponse, which is defined in Models.SampleResponse. https://github.com/cfiken/SwagGenTest/blob/master/generated_4.2.0/Sources/Requests/Sample/GetSomeEndpoint.swift#L53

In v4.3.1, however, the type of Response is Status200 which is defined in the same file. Therefore the definition in Models.SampleResponse is not used here. https://github.com/cfiken/SwagGenTest/blob/master/generated/Sources/Requests/Sample/GetSomeEndpoint.swift#L85

In this case the former v4.2.0 case is the behavior what I expected, but I couldn't figure out if the latter v4.3.1 is a SwagGen bug or a specification by openapi.yml definition.

Is this kind of bug? or just a mistake on my part?