Hi,

I'm not sure where the `widget` value comes from - its not in the OpenAPI 
Specification, and Swagger-UI does not support it.

Is there any reason you can't use `enum` directly, instead of using it 
inside of `oneOf`s? That would give you a dropdown menu in the UI that you 
can use.

Example YAML attached, screenshot available 
here: https://pasteboard.co/Hldqwaa.png


On Sunday, May 13, 2018 at 10:00:15 PM UTC-7, [email protected] wrote:
>
> Hi Ron,
>
> Yes we need to add a custom tag to that, For ease of the UI team to 
> identify its should be a radio button or toggle. Is this possible.
>
> Regards 
>
> On Saturday, May 12, 2018 at 6:35:18 AM UTC+5:30, Ron wrote:
>>
>> Widget?
>>
>>  
>>
>>  
>>
>>  
>>
>> *From: *<[email protected]> on behalf of "
>> [email protected]" <[email protected]>
>> *Reply-To: *"[email protected]" <
>> [email protected]>
>> *Date: *Friday, May 11, 2018 at 00:43
>> *To: *Swagger <[email protected]>
>> *Subject: *Re: How to Use oneOf tag
>>
>>  
>>
>> Hi All,
>>
>>  
>>
>> I manage to get oneOf tag sorted by upgrading to swagger version 3.0.0. 
>> But still i have issue in *widget: "radio". *can any one help me on this.
>>
>>  
>>
>>
>>
>> OneOf Tag Reference : 
>> https://github.com/OAI/OpenAPI-Specification/issues/333
>>
>>
>>
>> Thank you in advance.
>>
>>  
>>
>>
>>
>>
>>
>>
>> On Friday, May 11, 2018 at 9:34:30 AM UTC+5:30, [email protected] 
>> wrote: 
>>
>> Hi All,
>>
>>  
>>
>> I need to create add a property with oneOf tag. We are planing to use 
>> this for Radio button selection. I tried using oneOf tag but i get an error 
>> saying should NOT have additional properties assitionalProperty: oneOf.
>>
>>  
>>
>> Output should be as bellow,
>>
>>  
>>
>> *pet: { description: "Pet", type: "string", widget: "radio", oneOf: [ { 
>> enum: ["dog"], description: "Dog" }, { enum: ["cat"], description: "Cat" },*
>>
>> *{ enum: ["both"], description: "Both" }, ], default:"dog" }*
>>
>>
>>
>> I tried writing as bellow, (i get Errors in widget and onrOf tag)
>>
>>  
>>
>>  properties:     
>>       pet:
>>         description: Pet
>>         type: object
>>         default: dog
>>         widget: raido
>>         oneOf:
>>           - $ref: '#/definitions/dog'
>>           - $ref: '#/definitions/cat'
>>           
>>           
>>           
>>  Two Definitions as bellow         
>>           
>> dog:
>>     type: object
>>     properties:
>>       id_type:
>>         type: string
>>         enum: [dog]
>>         description: "DOG"
>>         
>> cat:
>>     type: object
>>     properties:
>>       id_type:
>>         type: string
>>         enum: [cat]
>>         description: "CAT"
>>
>>
>>
>>
>>
>> i would appriciate if some one can help me to sort this, Thank you.
>>
>> -- 
>> 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.

Attachment: enum-example.yaml
Description: Binary data

Reply via email to