There’s no easy answer for this. Array values have to be homogeneous. You can describe the lowest common denominator of them as one option, but it’s not ideal.
I’m not really sure why you say it doesn’t fit the inheritance model. Composition wouldn’t help in this case. From: <[email protected]> on behalf of Matthew Markland <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Tuesday, 15 November 2016 at 13:36 To: Swagger <[email protected]> Subject: Arrays of mixed data. All: I'm new to both REST APIs and Swagger and have been tasked with looking at an existing API and documenting it. I've run into something that doesn't really fit either an inheritance or a compositional model well and am wondering if it just doesn't fit into Swagger's modeling ideology. Unfortunately I can't give exact structures, so I'll do my best to capture the issue. Let's say I have a JSON output like this: "events": [ { "type": "Events" "sub_type": "ONE" "transformed": [ { Transformed Entry }. ], "raw_data": [ { RAW_DATA_FORM_ONE }. { RAW_DATA_FORM_ONE } ] }, { { "type": "Events" "sub_type": "TWO" "transformed": [ { Transformed Entry }. ], "raw_data": [ { RAW_DATA_FORM_TWO }. { RAW_DATA_FORM_TWO } ] } ] So, basically I have an array of objects which contain many fields in common, but have a field that has a radically different format between entries. It isn't inheritance because I can't define the raw_data fields in terms of each other; they don't share anything, and it isn't composition per se because I can't say that an "events" entry is composed of all the types. It may be I'm just not understanding how to use Swagger in this case. Would someone be willing to offer some guidance? Thanks! Matt Markland -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
