Forum Discussion
Thanks for your response ponelat . Sorry I misunderstood the server response. So since we dont have a Dog or Cat model in the repository swagger-petstore/src/main/java/io/swagger/petstore/model at master · swagger-api/swagger-petstore · GitHub, we dont get Cat or Dog properties in server response when we do GET operation, eventhough we POST Cat or Dog properties in the request body of POST. Is that correct? Looking forward for your response. Thank you
deepika_u95 there are a few concepts we need to establish.
1. Annotations in the petstore demo referenced will generate an OpenAPI file
2. Describing an API is different from implementing it. We can use OpenAPI to describe an API (new or existing) that will tell consumers what to expect.
3. The relationship between GET/POST/PUT is arbitrary, which means your GET can do one thing and your POST can do something completely different, it is up to you the API designer to decide what they should do.
I believe you're asking how to implement GET /pets/... to return one of two types, a Cat or a Dog.
To do that, you would edit the controller files.
Related Content
- 3 years ago
- 6 years ago
Recent Discussions
- 7 hours ago
- 11 days ago
- 28 days ago