swagger-2.0

Validating request path parameter of AWS API gateway?

限于喜欢 提交于 2019-11-30 15:47:30
问题 Let's say I have an api with paths / and /{pets} and /{pets}/pet . Now I'm trying to validate the path {pets} parameter so that only path having alphanumerical characters of length 6 will be validated and processed to the backend lambda all others will be rejected. I tried the following swagger schema specifying format and type for the parameter. I even tried using pattern in the schema but it seems to be not working. May I know how can we limit only path parameters of certain IDs. { ...... "

Unable to bring up swagger-ui from spring-boot application

社会主义新天地 提交于 2019-11-30 13:44:18
问题 I have a spring boot application that i am running using embedded tomcat server. I am partially successful in getting springfox-swagger integrated with the app. If i do a /v2/api-docs , i am able to see all the documentation of all the api's in the webapp. However, when i am trying to access the same from UI, it does not work. Below are the detailed results. Output of - localhost:8080/api/swagger-resources [ { "name" : "default", "location" : "/v2/api-docs", "swaggerVersion" : "2.0" } ]

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

血红的双手。 提交于 2019-11-30 10:58:50
I'm using http://editor.swagger.io to design an API and I get an error which I don't know how to address: Schema error at paths['/employees/{employeeId}/roles'].get.parameters[0] should NOT have additional properties additionalProperty: type, format, name, in, description Jump to line 24 I have other endpoints defined in a similar way, and don't get this error. I wondered if I had some issue with indentation or unclosed quotes, but that doesn't seem to be the case. Google also did not seem to provide any useful results. swagger: "2.0" info: description: Initial draft of the API specification

Using Swashbuckle for Asp.net core how can I add a model to the generated model list?

匆匆过客 提交于 2019-11-30 09:39:59
I'm using Swashbuckle with ASP.net core. It is producing a nice website with a list of models at the bottom. How can I add a model to this list that isn't already appearing? I return an abstract class in one of my requests and I want to list all the variations that inherit that abstract class. Thanks in advance You could create an document filter and register it globally. public class CustomModelDocumentFilter<T> : IDocumentFilter where T : class { public void Apply(SwaggerDocument swaggerDoc, DocumentFilterContext context) { context.SchemaRegistry.GetOrRegister(typeof(T)); } } and then

Unable to bring up swagger-ui from spring-boot application

孤者浪人 提交于 2019-11-30 08:24:12
I have a spring boot application that i am running using embedded tomcat server. I am partially successful in getting springfox-swagger integrated with the app. If i do a /v2/api-docs , i am able to see all the documentation of all the api's in the webapp. However, when i am trying to access the same from UI, it does not work. Below are the detailed results. Output of - localhost:8080/api/swagger-resources [ { "name" : "default", "location" : "/v2/api-docs", "swaggerVersion" : "2.0" } ] Output of - localhost:8080/api/v2/api-docs I get valid results. I can confirm that and the output is too

How to make a field in a definition required for some operations and not others

拜拜、爱过 提交于 2019-11-30 07:54:36
问题 I'm writing my swagger definition in yaml. Say I have a definition that looks something like this. paths: /payloads: post: summary: create a payload ... parameters: - in: body name: payload description: New payload required: true schema: $ref: "#/definitions/payload" put: summary: update a payload ... parameters: - in: body name: payload description: Updated existing payload required: true schema: $ref: "#/definitions/payload" ... definitions: payload: properties: id: type: string

How to generate swagger.json

别来无恙 提交于 2019-11-30 06:29:54
问题 I am using java spring boot framework to create REST api for my project and I am using "springfox-swagger2 and springfox-swagger-ui" for generating swagger documentation. I am able to see my documentation using the URL http://localhost:8080/swagger-ui.html. How can I create or generate swagger.json / spec.json , The documentation should not be with this application, we are using a separate application for listing the API docs. 回答1: You can get the url with your swagger-ui html page: GET http:

How to describe this POST JSON request body in OpenAPI (Swagger)?

烂漫一生 提交于 2019-11-30 02:42:30
I have a POST request that uses the following JSON request body. How can I describe this request body using OpenAPI (Swagger)? { "testapi": { "testapiContext": { "messageId": "kkkk8", "messageDateTime": "2014-08-17T14:07:30+0530" }, "testapiBody": { "cameraServiceRq": { "osType": "android", "deviceType": "samsung555" } } } } So far I tried the following, but I'm stuck at defining the body schema . swagger: "2.0" info: version: 1.0.0 title: get camera license: name: MIT host: localhost basePath: /test/service schemes: - http consumes: - application/json produces: - application/json paths:

How to group multiple parameters in Swagger 2.0?

守給你的承諾、 提交于 2019-11-30 02:37:46
问题 Is it possible to group multiple parameters to reference them in multiple routes? For example I have a combination of parameters which I need in every route. They are defined as global parameters. How can I group them? I think about a definition like this: parameters: MetaDataParameters: # Meta Data Properties - name: id in: query description: Entry identification number required: false type: integer - name: time_start in: query description: Start time of flare required: false type: string -

How to define role/permission security in Swagger

时光总嘲笑我的痴心妄想 提交于 2019-11-30 01:35:30
问题 In my API documentation, I would like to define the security necessary for each API endpoint. The project has defined roles and permissions that determine which users can access the APIs. What is the best way in Swagger to document this information? Is there a best practice or recommendation on how to show this detail? This what I tried out using securityDefinitions and a self-defined variable for the roles, but that information (x-role-names) didn't get copied over into the documentation