swagger-2.0

Swagger UI - “ TypeError: Failed to fetch” on valid response

家住魔仙堡 提交于 2020-01-09 19:24:06
问题 I've just pulled down the latest Swagger from the Git repo (3.0.19) using: https://github.com/swagger-api/swagger-ui.git and updated my API to use the new version. Ran git describe --tags to confirm and my version is currently: v3.0.19-6-gaab1403 The problem I'm having is one described here, whereby my response is a 403 (I can see this in the inspector on the browser) and although I have a reponse for error 403, I still get the TypeError: Failed to fetch message. Here's a snippet from my

swagger limit error codes of response

旧时模样 提交于 2020-01-07 04:18:13
问题 There is a swagger 2.0 file I am dealing with, where I want to specify that the error code from my response can only be USERNAME_VALIDATION_FAILED or EMAIL_VALIDATION_FAILED. This is due to a swagger-ui view of the swaggerfile where every response error can have the 20 error codes defined in the Error code enum. How to limit the possible error codes for a specific response? In my swaggerfile there is the request /register: post: ... parameters: ... responses: ... 400: description: Username or

Swagger/Swashbuckle document POST with JSON

↘锁芯ラ 提交于 2020-01-07 03:08:10
问题 I have a challenge with Swashbuckle or Swagger. I'm not sure if the problem is with Swagger or Swashbuckle. I have web api call, implemented both with the parameter as URI params, and with reading the content from the body of the request. One is implemented like this: [Route("application/uri")] [HttpPost] public async Task<string> Post([ModelBinder] Application application) { return await RegisterApplication(application); } The other is implemented like this: [Route("loanapplication/json")]

Display Custom HashMap Key Using Swagger Annotations

Deadly 提交于 2020-01-05 04:20:18
问题 I'm trying to generate Swagger documentation from Java code and one of my nested model properties is a HashMap. The generated example for it is as follows: "additionalProp1": { "customObject": {} }, "additionalProp2": { "customObject": {} }, "additionalProp3": { "customObject": {} } What I need it to look like is: "objectName": { "customObject": {} } In other words, I need to tell them what the additionalProp String should be and preferably not have it repeated three times. Is there any way

AWS API Gateway with Lambda Authorizer

僤鯓⒐⒋嵵緔 提交于 2020-01-05 04:13:10
问题 I am trying to configure an API Gateway which takes a proxy parameter from the request path, and also a parameter from the Lambda authorizer return and put it in the header, so that it can be passed to my Elastic Beanstalk REST API running Spring Boot. The proxy path is working as expected; and I see my Lambda function is returning the variable "x-api-auth" in the "context" map as per documentation. The only piece not working is adding "x-api-auth" to the request header. :( Whenever I ran my

How can I make parameter optional in some but required in other cases in Swagger/PHP?

社会主义新天地 提交于 2020-01-04 05:43:06
问题 I'm documenting PHP REST-API with Swagger. So I defined my datamodel. My current Problem is, that the required state of some fields varies on different request types. My model looks like this: * @SWG\Definition(required={"firstName", "lastName"}) * * @SWG\Property(property="id", type="integer", example="5") * @property integer $id * * @SWG\Property(property="firstName", type="string", example="Test Name") * @property string $firstName * * @SWG\Property(property="lastName", type="string",

How to specify the default XML element text in OpenAPI (Swagger)?

元气小坏坏 提交于 2020-01-04 03:33:25
问题 I'm building an OpenAPI (Swagger) 2.0 definition for the following XML payload to use within the Swagger UI: <addressElement> <key type="RECORD_ID" item="3">Enter value here</key> </addressElement> I'm having an issue figuring out how to display the default value 'Enter value here' for the element key . Where would one place this default value in an OpenAPI definition? My definition looks like this: "definitions": { "addressElement": { "type": "object", "title": "Address Element", "properties

How to specify the default XML element text in OpenAPI (Swagger)?

人走茶凉 提交于 2020-01-04 03:33:02
问题 I'm building an OpenAPI (Swagger) 2.0 definition for the following XML payload to use within the Swagger UI: <addressElement> <key type="RECORD_ID" item="3">Enter value here</key> </addressElement> I'm having an issue figuring out how to display the default value 'Enter value here' for the element key . Where would one place this default value in an OpenAPI definition? My definition looks like this: "definitions": { "addressElement": { "type": "object", "title": "Address Element", "properties

Swagger: support for optional routes

假如想象 提交于 2020-01-03 13:07:48
问题 I have a route with an optional parameter: [Route("{categoryId?}")] public HttpResponseMessage Get(int? categoryId=null) However, when I don't provide a value for categoryId the call includes {categoryId?} in the request itself... http://myhost/api/%7BcategoryId%7D 回答1: Swagger has no support for optional path parameters. If you wish to document it this way, you'd have to create two separate paths - one without the path parameter and one with. 来源: https://stackoverflow.com/questions/30182657

Freeform subobject in json-schema

泄露秘密 提交于 2019-12-29 10:05:23
问题 I am drafting an API documentation with swagger.io and is trying to make it fit to our use case. The system is going to receive and process data from all sources, and they would each have different sets of fields. While the product of the processing share the same schema, we want to include the input in the schema too for reference purpose. For instance, given { "foo": "bar" "bar": "baz" } The product of the processing is { "original": { "foo": "bar", "bar": "baz" } "processed": { "stdFieldA"