当我使用邮递员时,谷歌似乎没有验证我的请求正文架构,甚至没有验证请求有正文。我错过了什么吗?对我来说,这意味着谷歌在调用 x-google-backend 之前会验证这种事情,但它总是将请求传递给我的云函数,无论我是否传递有效数据。
我在这里使用这个问题作为指导。
/users:
post:
summary: Creates a new user.
operationId: createUser
consumes:
- application/json
parameters:
- in: body
name: body
description: The user to create.
required: true
schema:
$ref: './schemas/user.yaml'
x-google-backend:
address: https://us-central1-blablabla.cloudfunctions.net/blabla
responses:
201:
description: Created
用户.yaml:
type: object
required:
- username
- password
- repeatPassword
- email
properties:
username:
type: string
minLength: 3
maxLength: 50
password:
type: string
minLength: 6
maxLength: 64
repeatPassword:
type: string
minLength: 6
maxLength: 64
email:
type: string
minLength: 3
maxLength: 50