问题描述 投票:0回答:1

but when I am going to use it , it is only valid if the parameter is all lower case like

"platform=online"
, obviously to match the enum value.

如何使模式变得不敏感并了解所有类型的参数?

    

源是病例敏感的。要具有不敏感的模式,您可以使用正则表达式pattern

enums openapi
1个回答
13
投票

Note that

pattern
is the pattern itself and does not support JavaScript regex literal syntax (

/abc/i
), which means you cannot specify 
flags

like

i
(case insensitive search).结果,您需要在图案本身中指定大写字母和小写字母。
Alternatively, specify the possible values in the description rather than in 
pattern
/

enum
, and verify the parameter values on the back end.

Here's the related discussion in the JSON Schema repository (OpenAPI uses JSON Schema to define the data types): 
Case Insensitive Enums?
    


最新问题
© www.soinside.com 2019 - 2024. All rights reserved.