cancel
Showing results for 
Search instead for 
Did you mean: 

how to Define Map<Enum,String> in open API specification swagger

New Member

how to Define Map<Enum,String> in open API specification swagger

i would like to have my swagger open API spefication like this

 

Map<ModeToContactEnum, String>

 

ModeToContactEnum{

ph, in_prsn, app, othrs, no_cntct_yt

}

 

i tried the following it is not woking as expected

modeToContactToMerchantPhone:
type: object
additionalProperties:
type: string

 

1 REPLY 1
Highlighted
Moderator

Re: how to Define Map<Enum,String> in open API specification swagger

Hi @venkaiah,

 

This is not possible in the current version of OpenAPI, but will be possible in the next version, OpenAPI 3.1, using the propertyNames keyword. Check out this post for details and examples:

How to restrict map keys in OpenAPI?


Helen Kosova
SmartBear Documentation Team Lead
________________________
Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Top Kudoed Authors