我正在使用Swagger制作API,并尝试更新YAML以向参数添加正则表达式模式要求。目前,我正在尝试以下操作:
# getCPIStatesForCountry endpoint
/getCPIStatesForCountry:
# This is a HTTP operation
get:
# Describe this verb here. Note: you can use markdown
description: |
Returns a list of states for a given country
produces:
- application/json
# This is array of GET operation parameters:
parameters:
-
name: country_code
in: query
description: Code of desired country
required: true
type: string
pattern: "^[a-zA-Z]+$"
然而,Swagger UI 允许我输入任何有效的内容。为什么会这样?