我正在尝试通过 python connexion 创建一个简单的 post API。这是我的 api yaml 文件:
swagger: "2.0"
info:
title: "My first API"
version: "1.0"
basePath: /v1.0
paths:
/potential:
post:
operationId: api.data.create_potential_data
summary: Create the potential data
parameters:
- name: alertCategory
in: body
required: True
description: The potential API request AlertCategoryDto object with settings of alert category (categorySystemName, alert Kpis etc.)
schema:
$ref: "#/definitions/alert"
responses:
201:
description: Successfully created potential data
definitions:
alert:
properties:
systemName:
type: string
name:
type: string
moduleSystemName:
type: string
name
但是对于我们允许用户输入null
值的属性之一。如果他们真的这样做,我们将得到error: None type is not of type 'string'
那么在 swagger 2.0 中有没有让属性可以为空?网上找不到太多资料。谢谢!