如何解决SwaggerUi不从yml文件中获取数据
我对Swagger还是陌生的,他试图为自己的应用程序实现它。我的问题是SwaggerUi不会将我的swagger.yml文件带入控制器。实际上,我在身份验证方面遇到了问题。
Swagger.yml
swagger: "2.0"
info:
version: "1.1"
title: ABC Operations
termsOfService: http://swagger.io/terms/
host: <HOST>
basePath: /abc/operations
tags:
- name: Stored Message
description: Stored Message Operations
schemes:
- http
- https
security:
- basic_auth: []
paths:
/stored-message/{transactionId}:
get:
tags:
- Stored Message
summary: Stored Message Retrieval by TransactionId
produces:
- application/json
parameters:
- in: path
name: transactionId
required: true
type: string
responses:
200:
description: OK
schema:
type: object
404:
description: Not Found
500:
description: Internal Server Error
put:
tags:
- Stored Message
summary: Stored Message Update
consumes:
- application/json
produces:
- application/json
parameters:
- in: path
name: transactionId
required: true
type: string
- in: body
name: Modified Stored Message
schema:
type: object
responses:
200:
description: OK
404:
description: Not Found
500:
description: Internal Server Error
securityDefinitions:
basic_auth:
type: basic
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
实际上,在SwaggerUi部分中,默认情况下它不会填写新字段。 我该如何使招摇的Ui从swagger.yml中获取数据?
解决方法
在“ application.property”文件中,您必须添加此字符串
springdoc.swagger-ui.url: /yourfilename.yml
of并指定要用于启动swaggerUi的yml文件。
该文件必须位于 src-> resource-> static 内部才能查看。我建议您在Springdoc网站https://springdoc.org/faq.html上查看正式文档。
美好的一天
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。