cancel
Showing results for 
Search instead for 
Did you mean: 

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

venkaiah
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
HKosova
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
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Top Kudoed Authors