xiejun
2024-11-01 80b6cbfc9c861469146318d0b3dd5f8b8b525b8a
Source/BladeX-Tool/blade-starter-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,177 @@
/*
 *
 *      Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: lengleng (wangiegie@gmail.com)
 *
 */
package org.springblade.core.swagger;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springblade.core.launch.constant.AppConstant;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
 * SwaggerProperties
 *
 * @author Chill
 */
@Data
@ConfigurationProperties("swagger")
public class SwaggerProperties {
   /**
    * swagger会解析的包路径
    **/
   private List<String> basePackages = new ArrayList<>(Collections.singletonList(AppConstant.BASE_PACKAGES));
   /**
    * swagger会解析的url规则
    **/
   private List<String> basePath = new ArrayList<>();
   /**
    * åœ¨basePath基础上需要排除的url规则
    **/
   private List<String> excludePath = new ArrayList<>();
   /**
    * æ ‡é¢˜
    **/
   private String title = "BladeX æŽ¥å£æ–‡æ¡£ç³»ç»Ÿ";
   /**
    * æè¿°
    **/
   private String description = "BladeX æŽ¥å£æ–‡æ¡£ç³»ç»Ÿ";
   /**
    * ç‰ˆæœ¬
    **/
   private String version = AppConstant.APPLICATION_VERSION;
   /**
    * è®¸å¯è¯
    **/
   private String license = "Powered By BladeX";
   /**
    * è®¸å¯è¯URL
    **/
   private String licenseUrl = "https://bladex.vip";
   /**
    * æœåŠ¡æ¡æ¬¾URL
    **/
   private String termsOfServiceUrl = "https://bladex.vip";
   /**
    * host信息
    **/
   private String host = "";
   /**
    * è”系人信息
    */
   private Contact contact = new Contact();
   /**
    * å…¨å±€ç»Ÿä¸€é‰´æƒé…ç½®
    **/
   private Authorization authorization = new Authorization();
   @Data
   @NoArgsConstructor
   public static class Contact {
      /**
       * è”系人
       **/
      private String name = "chillzhuang";
      /**
       * è”系人url
       **/
      private String url = "https://gitee.com/smallc";
      /**
       * è”系人email
       **/
      private String email = "smallchill@163.com";
   }
   @Data
   @NoArgsConstructor
   public static class Authorization {
      /**
       * é‰´æƒç­–ç•¥ID,需要和SecurityReferences ID保持一致
       */
      private String name = "";
      /**
       * éœ€è¦å¼€å¯é‰´æƒURL的正则
       */
      private String authRegex = "^.*$";
      /**
       * é‰´æƒä½œç”¨åŸŸåˆ—表
       */
      private List<AuthorizationScope> authorizationScopeList = new ArrayList<>();
      /**
       * é‰´æƒè¯·æ±‚头参数列表
       */
      private List<AuthorizationApiKey> authorizationApiKeyList = new ArrayList<>();
      /**
       * æŽ¥å£åŒ¹é…åœ°å€
       */
      private List<String> tokenUrlList = new ArrayList<>();
   }
   @Data
   @NoArgsConstructor
   public static class AuthorizationScope {
      /**
       * é‰´æƒç­–略名, éœ€è¦å’ŒApiKey的name保持一致
       */
      private String name = "";
      /**
       * ä½œç”¨åŸŸåç§°
       */
      private String scope = "";
      /**
       * ä½œç”¨åŸŸæè¿°
       */
      private String description = "";
   }
   @Data
   @NoArgsConstructor
   public static class AuthorizationApiKey {
      /**
       * å‚数名
       */
      private String name = "";
      /**
       * å‚数值
       */
      private String keyName = "";
      /**
       * å‚数作用域
       */
      private String passAs = "";
   }
}