From ac9e3f2ca4d2255739f8b60165f5b51b31ccd3e6 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期五, 13 一月 2023 23:04:08 +0800 Subject: [PATCH] update 适配 springdoc 新版本配置方式 --- ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java | 95 +++++++++++++++++++++++++++-------------------- 1 files changed, 54 insertions(+), 41 deletions(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java index c2b3f97..736d70a 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java @@ -1,8 +1,14 @@ package com.ruoyi.framework.config.properties; +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.ExternalDocumentation; +import io.swagger.v3.oas.models.Paths; +import io.swagger.v3.oas.models.info.Contact; +import io.swagger.v3.oas.models.info.License; +import io.swagger.v3.oas.models.tags.Tag; import lombok.Data; -import lombok.NoArgsConstructor; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; import org.springframework.stereotype.Component; import java.util.List; @@ -18,70 +24,77 @@ public class SwaggerProperties { /** - * 楠岃瘉鐮佺被鍨� + * 鏄惁寮�鍚� openApi 鏂囨。 */ - private Boolean enabled; - /** - * 璁剧疆璇锋眰鐨勭粺涓�鍓嶇紑 - */ - private String pathMapping; - /** - * 楠岃瘉鐮佺被鍒� - */ - private String title; - /** - * 鏁板瓧楠岃瘉鐮佷綅鏁� - */ - private String description; - /** - * 瀛楃楠岃瘉鐮侀暱搴� - */ - private String version; + private Boolean enabled = true; /** - * 鑱旂郴鏂瑰紡 + * 鏂囨。鍩烘湰淇℃伅 */ - private Contact contact; + @NestedConfigurationProperty + private InfoProperties info = new InfoProperties(); /** - * 缁勯厤缃� + * 鎵╁睍鏂囨。鍦板潃 */ - private List<Groups> groups; + @NestedConfigurationProperty + private ExternalDocumentation externalDocs; + /** + * 鏍囩 + */ + private List<Tag> tags = null; + + /** + * 璺緞 + */ + @NestedConfigurationProperty + private Paths paths = null; + + /** + * 缁勪欢 + */ + @NestedConfigurationProperty + private Components components = null; + + /** + * <p> + * 鏂囨。鐨勫熀纭�灞炴�т俊鎭� + * </p> + * + * @see io.swagger.v3.oas.models.info.Info + * + * 涓轰簡 springboot 鑷姩鐢熶骇閰嶇疆鎻愮ず淇℃伅锛屾墍浠ヨ繖閲屽鍒朵竴涓被鍑烘潵 + */ @Data - @NoArgsConstructor - public static class Contact { + public static class InfoProperties { /** - * 鑱旂郴浜� + * 鏍囬 */ - private String name; + private String title = null; /** - * 鑱旂郴浜簎rl + * 鎻忚堪 */ - private String url; + private String description = null; /** - * 鑱旂郴浜篹mail + * 鑱旂郴浜轰俊鎭� */ - private String email; - - } - - @Data - @NoArgsConstructor - public static class Groups { + @NestedConfigurationProperty + private Contact contact = null; /** - * 缁勫悕 + * 璁稿彲璇� */ - private String name; + @NestedConfigurationProperty + private License license = null; /** - * 鍩虹鍖呰矾寰� + * 鐗堟湰 */ - private String basePackage; + private String version = null; } -- Gitblit v1.9.3