Я использую Springfox для создания документации Swagger из контроллеров пружин.При посещении http://127.0.0.1:8080/mycontextroot/swagger-ui.html
я получил swagger UI, который работает!
Но когда я пытаюсь открыть тот же yaml
(или json
) файл, сгенерированный из http://127.0.0.1:8080/mycontextroot/v2/api-docs
, но через https://editor.swagger.io/
Я получил ошибку:
Swagger samle:
---
swagger: '2.0'
info:
description: Api Documentation
version: '1.0'
title: Api Documentation
termsOfService: urn:tos
contact: {}
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0
host: 127.0.0.1:8080
basePath: "/"
paths:
"/mycontextroot/blogs":
get:
summary: blogs
operationId: blogsUsingGET
produces:
- "*/*"
responses:
'200':
description: OK
schema:
"$ref": "#/definitions/Blogs"
'401':
description: Unauthorized
'403':
description: Forbidden
'404':
description: Not Found
security:
- xauth:
- global
deprecated: false
securityDefinitions:
xauth:
type: apiKey
name: my-auth-header
in: header
definitions:
Blog:
type: object
properties:
title:
type: string
title: Blog
Blogs:
type: object
properties:
blogs:
type: array
items:
"$ref": "#/definitions/Blog"
title: Blogs