我正在使用swagger创建一个API,并试图更新YAML以将regex模式需求添加到参数中。目前,我正在尝试以下几点:
# 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允许我输入任何作为有效输入的内容。为什么会这样呢?
发布于 2017-04-19 17:20:03
SwaggerUI3.4.3及更高版本支持针对pattern的参数验证。
https://stackoverflow.com/questions/43498418
复制相似问题