I'll use the example 
at: 
https://github.com/OAI/OpenAPI-Specification/blob/master/fixtures/v2.0/json/models/modelWithComposition.json
to help illustrate my question.

Lets say in the body of a post I expect and array of pets.  I would like to 
display to a user all of the possible pet structures they
can send me in that array.  Currently, swagger is only displaying the one 
shared field (petType in this case) if I were to do something like:

pets:
        type: array
        items:
          $ref: '#/definitions/Pet'

How can I make it so it shows Cat, Dog, and Fish in the array, instead of 
just the one shared field?

Thanks.


On Wednesday, October 4, 2017 at 1:58:52 PM UTC-7, Ron wrote:
>
> The information is still not clear to me. Can you provide more details?
>
>  
>
>  
>
>  
>
> *From: *<[email protected] <javascript:>> on behalf of 
> Nathaniel Graham <[email protected] <javascript:>>
> *Reply-To: *"[email protected] <javascript:>" <
> [email protected] <javascript:>>
> *Date: *Tuesday, October 3, 2017 at 11:39
> *To: *Swagger <[email protected] <javascript:>>
> *Subject: *array of objects help
>
>  
>
> Hello, 
>
>  
>
> I have been doing some googling and trying various different approaches to 
> solve my problem, but have so far been unsuccessful.
>
>  
>
> One of the post endpoints in my api takes an array of objects.  The array 
> may include any combination of these objects and may contain
>
> multiple versions of the same object.  Some example objects are:
>
>  
>
> "authorize": {
>
> "id": {
>
> "type": "field_type",
>
> "value": "user_input/match_value"
>
> }
>
> }
>
>  
>
> "set_variable": {
>
> "name": {
>
> "type": "field_type",
>
> "value": "user_input/match_value"
>
> },
>
> "condition": {
>
> "type": "regex/equal",
>
> "value": "if regex, regex string"
>
> },
>
> "value": {
>
> "type": "field_type",
>
> "value": "user_input/match_value"
>
> }
>
> }
>
>  
>
> The name of the array these come in in is "action".  Ideally I would like 
> a user to be able to click the action array, and be taken to a
>
> description of each of these actions.
>
>  
>
> The closest I have gotten so far is the following:
>
>  
>
> "rules": {
>
>       "type": "object",
>
>       "required": [
>
>         "conditional",
>
>         "action"
>
>       ],
>
>       "properties": {
>
>         "conditional": {
>
>           "type": "array",
>
>           "items": {
>
>             "$ref": "#/definitions/conditional"
>
>           }
>
>         },
>
>         "action": {
>
>           "type": "array",
>
>           "items": {
>
>             "$ref": "#/definitions/actions"
>
>           }
>
>         }
>
>       }
>
>     },
>
>     "actions": {
>
>       "type": "object",
>
>       "properties": {
>
>         "authorize": {
>
>           "$ref": "#/definitions/authorize"
>
>         },
>
>         "set_variable": {
>
>           "$ref": "#/definitions/set_variable"
>
>         }
>
>       }
>
>     }
>
>  
>
> There are a lot more of these actions, but I am only including two for 
> brevity.
>
>  
>
> Thanks for any suggestions!
>
>  
>
> -Nathan
>
> -- 
> 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] <javascript:>.
> 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.

Reply via email to