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
:
Note that
pattern
is the pattern itself and does not support JavaScript regex literal syntax (/abc/i
), which means you cannot specifyflags
like
i
(case insensitive search).结果,您需要在图案本身中指定大写字母和小写字母。
Alternatively, specify the possible values in the description
rather than in pattern
/enum
Here's the related discussion in the JSON Schema repository (OpenAPI uses JSON Schema to define the data types):
Case Insensitive Enums?