swagger

Can I make swagger-php use arrays on the query string?

梦想的初衷 提交于 2019-12-10 17:03:31
问题 I use Swagger-php. When I define a parameter that's on the query string it can be an array. But from what I can see, it doesn't support this kind of querystring: https://api.domain.tld/v1/objects?q[]=1&q[]=5&q[]=12 I believe this would be set in the collectionFormatfield if possible. Currently I've just been using pipes , but I want to use the above format, and have Swagger-UI reflect this, too. However, I read this github issue which has left me wondering if this is actually possible and I

Use Swagger/OpenAPI discriminator so that Jackson serializes object correctly

天涯浪子 提交于 2019-12-10 16:40:09
问题 We're having trouble using the OpenAPI 2.0 discriminator in way that makes both the Swagger tools and the Jackson serializer happy. Problem: during serialization Jackson currently generates two JSON properties for the discriminator, one of them having a null value. OpenAPI 2.0 definition swagger: '2.0' info: version: v1 title: Error API paths: /errors: get: description: Stack Overflow test responses: '200': description: OK schema: $ref: '#/definitions/SpecificError' definitions: GeneralError:

how to do friendly base url for swagger 2.8.0

送分小仙女□ 提交于 2019-12-10 16:29:16
问题 I'm trying to change base access url for API documentation. The url is "http://localhost:8080/swagger-ui.html". I want to get something like "http://localhost:8080/myapi/swagger-ui.html". I use Springfox 2.8.0 Swagger, Java 8, Spring Boot 2.0 The swagger configuration is: @Configuration @EnableSwagger2 public class SwaggerConfiguration { @Bean public Docket api(ServletContext servletContext) { return new Docket(DocumentationType.SWAGGER_2) .pathProvider(new RelativePathProvider(servletContext

Spring @GetMapping with @RequestParam and @RequestBody fails with HttpMessageNotReadableException

*爱你&永不变心* 提交于 2019-12-10 16:23:38
问题 Request to the endpoint fails with the following error: 400 Bad request org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing @GetMapping public List<SomeObject> list(@RequestParam(required = false) String parameter, @RequestBody String body, @RequestHeader("Authorization") String token) { ..... } if @GetMapping would be changed to @PostMapping everything works like a charm though. Any ideas what the heck is going on ? NOTE: Swagger is used for

What are the options for swagger-editor to save json or yaml into remote backend?

社会主义新天地 提交于 2019-12-10 16:23:30
问题 I know that the Swagger-editor saves api documentation into the local browser cache ("Download Yaml/Json" and "Export Yaml/Json"). But what if I want to save it into a remote server then latter I can continue editing it from another browser. Are there already known Backends for Swagger-editor which I can use? Thanks in advance. 回答1: The swagger-node project has the editor built in and saves files in your filesystem. Follow the steps in the README to install and run. When you make changes in

Swagger not working on a self hosted ServiceStack Service

穿精又带淫゛_ 提交于 2019-12-10 15:49:16
问题 Following the code example at this URL : https://github.com/ServiceStack/ServiceStack/wiki/Self-hosting I created an empty solution, pasted the above C# code into 'program.cs' and ran the following nuget commands to get the required libraries and code files imported : Install-Package ServiceStack Install-Package ServiceStack.api.Swagger The service runs fine, the swagger meta data is delivered correctly, but when trying to visit /swagger-ui/index.html I get the error 'Handler not found' . I

How do I get Swagger UI to use port 443 with Swashbuckle?

99封情书 提交于 2019-12-10 15:38:45
问题 In our QA and Prod environments that run our RESTful web services, port 80 is not open. So currently when I try to get to Swagger UI in QA, I get this message and it just hangs: fetching resource list: http://qa-server:80/product-catalog-api/swagger/docs/v1; Please wait. I am using Swashbuckle to configure Swagger. I also changed this line in the config, but it still doesn't work. // If schemes are not explicitly provided in a Swagger 2.0 document, then the scheme used to access // the docs

How disable the swagger validator when using Swashbuckle for a net core web api project. Swashbuckle 6.0.0

自古美人都是妖i 提交于 2019-12-10 15:29:02
问题 How can I disable the Swagger Schema validator in options for Swashbuckle 6.0.0. I know it's turned off by default when I run locally but don't see validatorURL option for SwaggerUI() 回答1: Seems that there is an option on Swagger 6.0.0 to manage Validator. Didn't try myself, but seems to be pretty explicit on what it does. 回答2: from the github repository: This level of configuration will be available in the upcoming, stable 6.0.0 release as can be seen in the example website for custom UI

How to define array-of-objects as parameter?

懵懂的女人 提交于 2019-12-10 15:22:16
问题 I am quite new to Swagger , so this might be a basic question. I am able to create .yml file for an API which takes an array of integers as parameter, as follows: Add samples --- tags: - MY API parameters: - name: my_id in: path type: integer required: true description: Some des - name: body in: body schema: id: add_samples required: - sample_ids properties: sample_ids: type: array items: type: integer description: A list of sample ids to be added responses: '200': description: Added samples.

Swagger - Web API - Optional query parameters

浪子不回头ぞ 提交于 2019-12-10 14:57:00
问题 [HttpGet] [Route("students")] [SwaggerOperation(Tags = new[] { "Student" })] [SwaggerResponse(HttpStatusCode.OK, Type = typeof(ResponseModel<IList<Student>>))] [SwaggerResponseExample(HttpStatusCode.OK, typeof(StudentResponseExample))] [SwaggerResponse(HttpStatusCode.InternalServerError)] public IHttpActionResult SearchStudent() { IDictionary<string, string> searchParams = null; searchParams = ControllerContext.GetQueryStrings(); . . . } The above API has three optional parameters which will