Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
architecture
/
glsx-archetype
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 230610c0
authored
Apr 13, 2023
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
框架完善
1 parent
a1acfcf4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
rest-archetype-framework/rest-admin-swagger3/src/main/java/com/glsx/plat/swagger3/config/OpenApiConfig.java
rest-archetype-framework/rest-admin-swagger3/src/main/java/com/glsx/plat/swagger3/config/OpenApiConfig.java
View file @
230610c
...
...
@@ -9,9 +9,14 @@ import io.swagger.v3.oas.models.info.License;
import
io.swagger.v3.oas.models.media.StringSchema
;
import
io.swagger.v3.oas.models.parameters.Parameter
;
import
io.swagger.v3.oas.models.security.SecurityScheme
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springdoc.core.customizers.OpenApiCustomiser
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.Comparator
;
import
java.util.stream.Collectors
;
@Configuration
public
class
OpenApiConfig
{
...
...
@@ -23,8 +28,7 @@ public class OpenApiConfig {
return
new
OpenAPI
().
components
(
new
Components
().
addSecuritySchemes
(
TOKEN_HEADER
,
new
SecurityScheme
()
.
type
(
SecurityScheme
.
Type
.
APIKEY
)
// 这里配置 bearer 后,你的请求里会自动在 token 前加上 Bearer
.
scheme
(
"bearer"
)
.
scheme
(
"bearer"
)
//这里配置 bearer 后,你的请求里会自动在 token 前加上 Bearer
.
bearerFormat
(
"JWT"
)
).
addParameters
(
TOKEN_HEADER
,
new
Parameter
()
...
...
@@ -35,8 +39,8 @@ public class OpenApiConfig {
.
info
(
new
Info
()
.
title
(
"文档标题"
)
.
description
(
"文档描述"
)
.
contact
(
new
Contact
().
name
(
"作者"
).
email
(
"邮箱"
).
url
(
"可以
写你的博客
地址或不填"
))
//
参考 Apache 2.0 许可及地址,你
可以不配此项
.
contact
(
new
Contact
().
name
(
"作者"
).
email
(
"邮箱"
).
url
(
"可以
填关联网站
地址或不填"
))
//
参考 Apache 2.0 许可及地址,
可以不配此项
.
license
(
new
License
().
name
(
"Apache 2.0"
).
url
(
"https://www.apache.org/licenses/LICENSE-2.0.html"
))
.
version
(
"0.1"
)
)
...
...
@@ -47,4 +51,12 @@ public class OpenApiConfig {
);
}
// @Bean
// public OpenApiCustomiser sortTagsAlphabetically() {
// return openApi -> openApi.setTags(openApi.getTags()
// .stream()
// .sorted(Comparator.comparing(tag -> StringUtils.stripAccents(tag.getName())))
// .collect(Collectors.toList()));
// }
}
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment