【发布时间】:2019-08-08 00:25:33
【问题描述】:
(这是我的第一个堆栈溢出帖子,所以请放轻松,哈哈)
我正在使用:
-OpenApi (v3)
-L5-Swagger (swagger-php & swagger-ui 的封装)
我正在使用注释来生成 OpenAPI 规范。正在从控制台生成规范,没有错误。但是,在每个模型的每个属性中,一旦生成,就会添加一个附加属性。
我试过了:
1.重写模型,
2. 以不同的方式重写属性
我的一个模型和“id”属性:
/**
* Class ActionPlan
*
* @OA\Schema(
* description="Action Plans",
* title="Action Plan Schema",
* required={
* "id",
* "name",
* "organization_id",
* "assessment_period_id",
* "completed",
* "created_by",
* "updated_by"
* },
* )
*
* @OA\Property(
* property="id",
* type="integer",
* format="int32",
* description="Action Plan ID"
* )
这是正在生成的内容:
"ActionPlan": {
"title": "Action Plan Schema",
"description": "Action Plans",
"required": [
"id",
"name",
"organization_id",
"assessment_period_id",
"completed",
"created_by",
"updated_by"
],
"properties": {
"id": {
"schema": "ActionPlan",
"description": "Action Plan ID",
"type": "integer",
"format": "int32"
},
生成“模式”属性我在做什么?
当我将规范文件放入 Swagger 编辑器时,它说 ActionPlan.properties.id 不应该有其他属性。附加属性:架构。
我只是想知道创建“模式”属性发生了什么。
提前致谢!
【问题讨论】:
标签: swagger openapi swagger-editor swagger-php