Swagger.json x Openapi.json
higaooliveira opened this issue · 3 comments
Why when I use OpenApi.json I must declare all model examples manually and when I use Swagger.json all examples are already declared automatically
I'm not sure I understand. Can you elaborate a bit?
When I open Swagger UI, it parses a json to show all specs. My doubt is about the difference between when it parses openapi.json and swagger.json
- When it parses OpenApi.json, I need to configure a response Model example in my route, like this code snippet
data class PetsModel(val pets: MutableList<PetModel>) {
companion object {
val exampleModel = mapOf(
"pets" to listOf(
PetModel.exampleSpike,
PetModel.exampleRover
)
)
}
}
get<pets>("all".responds(ok<PetsModel>(example("model", PetsModel.exampleModel))))
And when it parses Swagger.json, I don't need to configure a responde Model example, like this code snippet:
get<pets>("all".responds(ok<PetsModel>()))
I just need to inform a response Type and it interprets an example automatically.
I'm asking this because the OpenApi.json looks more complete than Swagger.json but it is a little more manual
Ooof... it's been such a long time since I've worked on this code. 🤔
Can you show me what the returned JSON looks like for the Open API JSON vs the JSON generated for the Open API?
Unfortunately, this project is heavily self-service at this point. If there's a bug, I'm probably not going to have the time to fix this issue. I'm basically a caretaker at this point keeping the lights on. I'll merge a PR that is well tested.