swagger

Swagger - timestamp weird representation

…衆ロ難τιáo~ 提交于 2019-12-13 12:34:42
问题 I have Spring Boot controller and for easy API reference used Swagger. Question about timestamp . Why in generated documentation example looks like: "timestamp": { "date": 0, "day": 0, "hours": 0, "minutes": 0, "month": 0, "nanos": 0, "seconds": 0, "time": 0, "timezoneOffset": 0, "year": 0 } So why swagger have so strange example for timestamp no just simple numeric value, which standard describes this representation? 回答1: check open specification of Swagger (https://github.com/OAI/OpenAPI

SpringBoot集成Swagger(Swagger的使用),生成接口文档,方便前后端分离开发

橙三吉。 提交于 2019-12-13 10:38:20
首先上一张成果图。 1、Maven依赖 <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.7.0</version> </dependency> <!-- swagger-ui 用于查看的 --> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.7.0</version> </dependency> 2、需要自定义一个配置类,然后添加到Spring容器中。 import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders

JHipster, spring rest service with MultiPart and JSON, swagger/curl error

北城余情 提交于 2019-12-13 07:32:13
问题 I am having problems with JHipster to publish a rest spring service. The service includes a MultipartFile, parameters and a JSON object. To my knowledge, I should be able to publish as follows: public @ResponseBody ResponseEntity<DocumentId> addDoc(@RequestPart(required = true) MultipartFile file, @RequestPart(required = false) String folder, @RequestPart(required = true) MetadataDoc metadata) The swagger api does not recognize the parameter "metadata" declaring it as "undefined"data type.

Configuring swagger for spring boot app

丶灬走出姿态 提交于 2019-12-13 05:47:34
问题 I have following this article to configure swagger on my spring-boot app. Here is my SwaggerConfig class package com.path.to.project.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import

Sping Data REST Endpoints Not Generating In Swagger UI

本秂侑毒 提交于 2019-12-13 04:16:35
问题 I've implemented a controller using @BasePathAwareController which also takes advantage of Spring Data REST (for finds to expose sort/size etc.) along with some custom endpoints (for updates etc.). The application is working as expected and the endpoints Spring Data REST generates are working as expected and I can see the self links appear in the responses, however, i can't see these endpoints in Swagger UI. I can just see my custom endpoints defined in my Controller. According to this post I

Call Swagger generator for plugins

寵の児 提交于 2019-12-13 04:15:36
问题 i want to generate the swagger document for plugins. I point the endpoint for the api to a plugincontroller. In this i have a method to create the documentation for a particular version. While loading the plugin all items are already registered in the swagger tooling. (somehow the new documents don't get picked up by the swagger middleware that is why i need this workaround.) [HttpGet("api/plugins/swaggerdoc/{version}")] public IActionResult GetSwaggerDoc(string version) { SwaggerDocument gen

Swagger Editor shows the “Schema error: should NOT have additional properties” error for a path parameter

断了今生、忘了曾经 提交于 2019-12-13 03:42:06
问题 I am creating an OpenAPI (Swagger) definition and checking its validity in http://editor.swagger.io. For some reason, Swagger Editor shows this error: Schema error at paths['/some-endpoint/{id}/name-and-address'].get.parameters[0] should NOT have additional properties additionalProperty: type, allowEmptyValue, enum, name, in, description, required Jump to line 142 Below is my YAML file: paths: '/some-endpoint/{id}/name-and-address': get: tags: - InvolvedParty summary: Retrieve basic

Is there a way to make Restlet Swagger extension limit the API it shows?

匆匆过客 提交于 2019-12-13 03:38:55
问题 Is there a way to make Restlet Swagger extension limit the API it shows? There are paths in the API we have that should not be explosed (just yet), what is the strategy to make sure that at least only specific org.restlet.routing.Router will be exposed? As we have many Router s in the Application. 回答1: This isn't possible out of the box. The easier way to do that is IMO to patch the extension org.restlet.extension.swagger : Update the method getSwagger of the class SwaggerSpecificationRestlet

How to define default values for [FromQuery] parameters for the Swagger UI?

≯℡__Kan透↙ 提交于 2019-12-13 03:36:59
问题 I have an action: [HttpGet] [Route("foo")] public ActionResult Foo([FromQuery] MyClass request) { var image = ToImage(WidgetType.MedianSalesPriceSqft, request); return File(image.ToByteArray(), "image/png"); } below MyClass is defined: public class MyClass { [DefaultValue("90210")] public string Zip { get; set; } [DefaultValue("5361 Doverton Dr")] public string StreetAddress { get; set; } } When I hit /swagger/index.html and want to try out this API, I always have to enter the StreetAddress

How to minimize maven pom.xml

非 Y 不嫁゛ 提交于 2019-12-13 03:04:34
问题 I am working on a spring-boot maven project (Maven 3.5, Java 8). Because of using Swagger Codegen in my project to generate classes, "plugins" tag of the pom.xml is getting bigger: <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>2.2.3</version> <executions> <execution> <id>file1</id> <goals> <goal>generate<