0

What is suggested here removes the property from the generated swagger json but what I want is to a hide the property from the response of API call (eg. GET) based on the which API version the call gets made with. Attributes like [JsonIgnore] doesn't help me with my question.

Any ideas

Jackdaw
  • 7,626
  • 5
  • 15
  • 33
watchloop
  • 23
  • 4
  • 1
    Why don't you create another DTO for another version of API. E.g. if there is an existing `CreateUserDto` for v1 of the API add another one e.g. `CreateUserDtoV2' and use it in v2 API. – Alexey Andrushkevich Jan 13 '21 at 09:46
  • @AlexeyAndrushkevich That is what I initially did but it caused to keep changing my code everywhere(models,controllers etc) and resolve compile problems related to using v1 or v2's DTO till I reached a part of the code where I got stuck. – watchloop Jan 13 '21 at 15:57

0 Answers0