Forum Discussion

sksskek's avatar
sksskek
New Contributor
2 years ago

Swagger offers me wrong DTO models

Hello, I found a strange result in swagger-ui,

even though I registered each DTO in API normally on the code controller while using swagger.

 

If modify to the original DTO's key:value, it works fine.

 

However, the screen shows a different DTO. Other APIs also show selectively incorrect DTOs.
What's the problem in this case? How can I resolve this?

 

thanks for reading.

 

( Please understand that words can be awkward using a translator. )

 

 

  • Hi sksskek ,

     

    Could you share the OpenAPI file? And perhaps expend on:

    - What is the expected behaviour? Given the inputs

    - What is the actual output? 

     

    At a guess, it looks like you have an extra/unwanted field? Take a look at the `examples` field, which can override the auto-generated JSON examples. Docs: https://swagger.io/docs/specification/adding-examples/