我可以使用Flasger进行类型验证吗?

2024-05-15 14:15:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我想验证端点的数据类型。我正在使用decorators@swag.from('myschema.yml',validation=True),但是当我运行测试时,它会给我200个代码,而实际上应该是400个代码。我的yaml文件的片段

post:
      tags:
        - User
      summary: Edit 
      description: Edit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              id: user
              type: object
              properties:
                email:
                  type: string
                  description: user email
                name:
                  type: string

例如,当我在测试中将电子邮件的类型更改为布尔值时,它会给我200个代码


Tags: 代码fromdecoratorsstringemailymltypedescription