草庐IT

java - 如何将 @ApiModelProperty dataType 设置为 String 以获取 Swagger 文档

我正在使用SpringMVC(通过SpringBoot)并使用swagger-spring-mvc库集成了SwaggerAPI文档。我有一个看起来像这样的类:@ApiModelpublicclassCartItem{...privateMoneylistPrice;//jodamoneyclass@JsonSerialize(using=ToStringSerializer.class)@ApiModelProperty(required=true,dataType="java.lang.String")publicMoneygetListPrice(){returnlistPrice

spring - Swagger UI - 默认情况下如何扩展所有操作?

当我打开它时所有操作都显示为折叠状态,我希望它默认展开。我需要更改任何属性来实现它吗?这是我的Swaggerbean:@Configuration@EnableSwagger2publicclassSwaggerConfig{@BeanpublicDocketrestApi(){returnnewDocket(DocumentationType.SWAGGER_2).select().paths(regex("/api/.*")).build().directModelSubstitute(XMLGregorianCalendar.class,Date.class).apiInfo(a

spring - Swagger UI - 默认情况下如何扩展所有操作?

当我打开它时所有操作都显示为折叠状态,我希望它默认展开。我需要更改任何属性来实现它吗?这是我的Swaggerbean:@Configuration@EnableSwagger2publicclassSwaggerConfig{@BeanpublicDocketrestApi(){returnnewDocket(DocumentationType.SWAGGER_2).select().paths(regex("/api/.*")).build().directModelSubstitute(XMLGregorianCalendar.class,Date.class).apiInfo(a

html - 带有参数的Swagger ui url

如何以http://localhost:3000/resources/api/?key=aslkdajd1323121lklakskdl的形式传递基本urlSwagger的用户界面?我能够访问http://localhost:3000/resources/api但是当我添加身份验证过滤器并传递key时,它说,Unauthorized.使用swagger1.X在index.html中通过apiKeyauthorization预填充参数没有帮助,但是当我在UI中键入key时,它起作用了。无法理解其中的原因。希望有人能帮助我理解它。 最佳答案

c# - Swashbuckle/Swagger + ASP.Net 核心 : "Failed to load API definition"

我开发了一个ASP.NETCore2应用程序并包含了Swagger。一切正常,直到我引入了一个没有明确定义HTTP操作的方法:publicclassErrorController:Controller{[Route("/error")]publicIActionResultIndex(){returnStatusCode(500,newError("Internalerror."));}}当我用这种方法启动应用程序时,出现以下消息:FailedtoloadAPIdefinition.ErrorsFetcherrorInternalServerError/swagger/v1/swagg

json - go-swagger 使用路径参数为路由生成规范

我正在尝试生成符合Swagger2.0specification的jsonAPI文档使用go-swagger.我在为路径参数生成JSON文档时遇到问题,如下所示:PUT/foo/{bar}目前我的godoc看起来像这样://Updatebarinfoo//swagger:routePUT/foo/{bar}updateBar//Parameters://bar:barParam//Responses://500:myErrorResponsefunc(h*handler)update(req*http.Request,paramsmartini.Params)(int,string)结

java - Spring Boot + Springbox Swagger 错误

我有一个springboot项目想通过springbox与swagger集成。我的SpringBoot应用程序启动并运行良好。但是我添加了springbox后,它无法通过单元测试。这是我在项目中添加的详细信息。对于pom.xml,添加io.swaggerswagger-core1.5.3io.springfoxspringfox-swagger22.2.2io.springfoxspringfox-swagger-ui2.2.2然后用一个Swagger的配置类@Configuration@EnableSwagger2publicclassSwaggerConfig{@Beanpubli

java - Spring Boot + Springbox Swagger 错误

我有一个springboot项目想通过springbox与swagger集成。我的SpringBoot应用程序启动并运行良好。但是我添加了springbox后,它无法通过单元测试。这是我在项目中添加的详细信息。对于pom.xml,添加io.swaggerswagger-core1.5.3io.springfoxspringfox-swagger22.2.2io.springfoxspringfox-swagger-ui2.2.2然后用一个Swagger的配置类@Configuration@EnableSwagger2publicclassSwaggerConfig{@Beanpubli

spring - Swagger 未使用 Spring Boot 检测 Spring Data Rest API

我设置了一个SpringBoot项目,包括SpringDataRest和Swagger:org.springframework.bootspring-boot-starter-data-restio.springfoxspringfox-swagger22.4.0io.springfoxspringfox-swagger-ui2.4.0这是我的Swagger配置:@Configuration@EnableSwagger2publicclassSwaggerConfig{@BeanpublicDocketapi(){returnnewDocket(DocumentationType.SW

spring - Swagger 未使用 Spring Boot 检测 Spring Data Rest API

我设置了一个SpringBoot项目,包括SpringDataRest和Swagger:org.springframework.bootspring-boot-starter-data-restio.springfoxspringfox-swagger22.4.0io.springfoxspringfox-swagger-ui2.4.0这是我的Swagger配置:@Configuration@EnableSwagger2publicclassSwaggerConfig{@BeanpublicDocketapi(){returnnewDocket(DocumentationType.SW