We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
path-parameters /test/{index} 的 get接口的 response 存在test名称的对象 /test/{index} 的 post接口的 Body 也存在test名称的对象
swagger.json 如下 { "swagger": "2.0", "info": { "title": "unknown", "version": "last", "description": "unknown" }, "basePath": "", "tags": [ { "name": "公共分类", "description": "公共分类" } ], "schemes": [ "http" ], "paths": { "/test/{index}": { "get": { "tags": [ "公共分类" ], "summary": "testGet", "description": "", "parameters": [ { "name": "index", "in": "path", "description": "", "required": true, "type": "string" } ], "responses": { "200": { "description": "successful operation", "schema": { "type": "object", "properties": { "test": { "type": "object", "properties": { "get": { "type": "string" } }, "required": [ "get" ] } }, "required": [ "test" ], "title": "TestIndex" } } } }, "post": { "tags": [ "公共分类" ], "summary": "testPost", "description": "", "consumes": [ "application/json" ], "parameters": [ { "name": "index", "in": "path", "description": "", "required": true, "type": "string" }, { "name": "TestIndexBody", "in": "body", "schema": { "type": "object", "properties": { "test": { "type": "object", "properties": { "post": { "type": "string" } }, "required": [ "post" ] } }, "required": [ "test" ] } } ], "responses": { "200": { "description": "successful operation", "schema": { "type": "object", "title": "title", "properties": {} } } } } } } }
{ "swagger": "2.0", "info": { "title": "unknown", "version": "last", "description": "unknown" }, "basePath": "", "tags": [ { "name": "公共分类", "description": "公共分类" } ], "schemes": [ "http" ], "paths": { "/test/{index}": { "get": { "tags": [ "公共分类" ], "summary": "testGet", "description": "", "parameters": [ { "name": "index", "in": "path", "description": "", "required": true, "type": "string" } ], "responses": { "200": { "description": "successful operation", "schema": { "type": "object", "properties": { "test": { "type": "object", "properties": { "get": { "type": "string" } }, "required": [ "get" ] } }, "required": [ "test" ], "title": "TestIndex" } } } }, "post": { "tags": [ "公共分类" ], "summary": "testPost", "description": "", "consumes": [ "application/json" ], "parameters": [ { "name": "index", "in": "path", "description": "", "required": true, "type": "string" }, { "name": "TestIndexBody", "in": "body", "schema": { "type": "object", "properties": { "test": { "type": "object", "properties": { "post": { "type": "string" } }, "required": [ "post" ] } }, "required": [ "test" ] } } ], "responses": { "200": { "description": "successful operation", "schema": { "type": "object", "title": "title", "properties": {} } } } } } } }
这种情况下,生成的model有问题 model 中 get的test 是 models.TestIndexTest 类型, model中定义的类型是 TestindexTest。注意大小写,是不一样的,如下图
这个定义的TestindexTest,是post中的test的类型,也不是get中test字段的类型。
The text was updated successfully, but these errors were encountered:
测试可以通过设置title指定类型名称,避免这个问题
Sorry, something went wrong.
No branches or pull requests
path-parameters
/test/{index} 的 get接口的 response 存在test名称的对象
/test/{index} 的 post接口的 Body 也存在test名称的对象
swagger.json 如下
{ "swagger": "2.0", "info": { "title": "unknown", "version": "last", "description": "unknown" }, "basePath": "", "tags": [ { "name": "公共分类", "description": "公共分类" } ], "schemes": [ "http" ], "paths": { "/test/{index}": { "get": { "tags": [ "公共分类" ], "summary": "testGet", "description": "", "parameters": [ { "name": "index", "in": "path", "description": "", "required": true, "type": "string" } ], "responses": { "200": { "description": "successful operation", "schema": { "type": "object", "properties": { "test": { "type": "object", "properties": { "get": { "type": "string" } }, "required": [ "get" ] } }, "required": [ "test" ], "title": "TestIndex" } } } }, "post": { "tags": [ "公共分类" ], "summary": "testPost", "description": "", "consumes": [ "application/json" ], "parameters": [ { "name": "index", "in": "path", "description": "", "required": true, "type": "string" }, { "name": "TestIndexBody", "in": "body", "schema": { "type": "object", "properties": { "test": { "type": "object", "properties": { "post": { "type": "string" } }, "required": [ "post" ] } }, "required": [ "test" ] } } ], "responses": { "200": { "description": "successful operation", "schema": { "type": "object", "title": "title", "properties": {} } } } } } } }
这种情况下,生成的model有问题
model 中 get的test 是 models.TestIndexTest 类型, model中定义的类型是 TestindexTest。注意大小写,是不一样的,如下图
这个定义的TestindexTest,是post中的test的类型,也不是get中test字段的类型。
The text was updated successfully, but these errors were encountered: