Closed niklassaers closed 1 month ago
Yes, check out the discriminator
feature of OpenAPI: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#discriminator-object
Thank you so much @czechboy0 , discriminator
did the trick :-)
Question
Hi, an API I'm using uses inheritance on objects and has many objects that are so similar that it's hard for swift-openapi-generator to get the correct result back. In the example below, it can easily confuse LoginPage and SearchPage.
However, each object contains a property "type" that matches a pattern (well, it's a constant pattern) so that the type HomePage has type == "HomePage", the type SearchPage has type == "SearchPage" and the type LoginPage has type == "LoginPage". When the JSON is being parsed into types, though, this pattern doesn't seem to be taken into account. Is that right? Is there anything I can do to make it take this "pattern" into account?
I've done my best to recreate the API as a better readable example: