Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swagger 招摇过市php添加了一个;“模式”;每个模型属性上的属性_Swagger_Openapi_Swagger Editor_Swagger Php - Fatal编程技术网

Swagger 招摇过市php添加了一个;“模式”;每个模型属性上的属性

Swagger 招摇过市php添加了一个;“模式”;每个模型属性上的属性,swagger,openapi,swagger-editor,swagger-php,Swagger,Openapi,Swagger Editor,Swagger Php,(这是我的第一篇堆栈溢出帖子,所以对我放松点,哈哈) 我正在使用: -OpenApi(v3) -L5-Swagger(Swagger-php和Swagger-ui的包装器) 我正在使用注释生成OpenAPI规范。从控制台生成规范时没有错误。但是,在每个模型的每个属性中,在生成后会添加一个附加属性 我试过: 1.重新编写模型, 2.以不同的方式重写属性 我的一个模型&id属性: /** * Class ActionPlan * * @OA\Schema( * d

(这是我的第一篇堆栈溢出帖子,所以对我放松点,哈哈)

我正在使用:
-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"
                },
我在做什么以生成一个“schema”属性

当我将spec文件放入Swagger编辑器时,它说ActionPlan.properties.id不应该有其他属性。附加属性:schema

我只是想知道创建“schema”属性会发生什么

提前谢谢

我了解到,这个“错误”实际上根本不是错误。这实际上是一个非常有用的功能,我只是不知道!当OA\Property在其对应的OA\Schema对象之外创建时,每个属性中都会添加一个“Schema”属性来创建一个引用,这样我们作为开发人员就不会对属性属于哪个OA\Schema感到困惑。要删除这个“schema”属性,只需将所有OA\Properties移动到它们对应的OA\schema对象中。就这样

/**
  * 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"
  *    )
  * )
  */