swagger

CORS issue with swagger

試著忘記壹切 提交于 2019-12-20 07:49:05
问题 We are trying to host api spec yml file in our svn repository which is hosted on another server. When we are pointing to yml file from this server we are getting cors error in swagger-ui. 回答1: You need to enable CORS on the server that hosts your YAML file. How you do this depends on the server you use. This site has instructions for many server types: https://enable-cors.org/server.html 来源: https://stackoverflow.com/questions/50983373/cors-issue-with-swagger

Swagger array of objects

假装没事ソ 提交于 2019-12-20 07:38:06
问题 I am having some issues with swagger: I have an array of objects (address) described in this way in the .yaml file: Address: properties: street: type: string city: type: string state: type: string country: type: string and this is the other yaml file with the definitions of the API (address is a params): - name: addresses in: formData description: List of adresses of the user. The first one is the default one. type: array items: $ref: '#/definitions/Address' And this is the text I put in the

represent a xml on Swagger yaml

99封情书 提交于 2019-12-20 07:14:13
问题 I'm making a document on swagger editor, but I don't know how solve that.. What do I need to write in a YAML file to get this result? <tag> <example Amount='100.00' NumberOfGuests='1'/> <example Amount='120.00' NumberOfGuests='2'/> <example Amount='140.00' NumberOfGuests='3'/> </tag> I tried to write "example" multiple times but an error appears: (YAML Syntax Error Duplicated mapping key at line 621) What do I need to do to represent the same tag multiple times with different values on the

Show Swagger validation information

蹲街弑〆低调 提交于 2019-12-20 05:32:07
问题 Swagger UI does not show request parameter's validation information. I want to show parameter's min value, max value, format, pattern(regex). Does anyone know the way how I express the parameter's validation information on Swagger UI? 回答1: Assuming you use Swagger UI 3.x (the latest version), add showCommonExtensions: true to the Swagger UI initialization code in your index.html file: const ui = SwaggerUIBundle({ "dom_id": "#swagger-ui", url: "https://petstore.swagger.io/v2/swagger.json",

Swashbuckle + XmlComments work locally, but fail swagger generation on server

无人久伴 提交于 2019-12-20 04:24:21
问题 I have a webapi project, and I am utilizing the swashbuckle framework to flush out api documentation. I have followed the directions to build the documentation xml file with my controller and DTO's, and it all works great locally. However, when generating the swagger document, a 500 error is thrown. I have confirmed if i remove my xml registration line, the swagger doc is generated and returned successfully. here is my registration line: GlobalConfiguration.Configuration.EnableSwagger(c => {

Adding Two .swift files with same name to project

橙三吉。 提交于 2019-12-20 04:10:22
问题 I am trying to integrate swagger client in my project. I was able to generate classes from swagger. Swagger for swift 3 uses Alamofire for its newtork operations. The issue is one of the generated class name is 'Response'. Alamofire internally has the same class. When i add these classes and try to build I have many errors complaining about re-declaration of class. What can i do in this case? Should i have to change from my server side to not get 'Response' class? 回答1: You should be able to

Swagger UI Multi level tagging

丶灬走出姿态 提交于 2019-12-20 03:32:20
问题 I just started working on Swagger api 2.0 recently.I am looking for some ways to organize the API documentation. Currently am using @Api(tags = {"Heading1"}) annotation to tag each api. Now the documentation looks like Tasks --------->Heading1 -------->Desc1 --------->Desc2 ---------->Heading2 --------->Desc3 --------->Desc4 But i am looking for adding some subheadings in the doc ,so that it looks like Tasks --------->Heading1 -------->Desc1 --------->SubHeading1 --------->Desc2 ----------

Validating JSON messages against Swagger definition in Java

江枫思渺然 提交于 2019-12-20 03:26:15
问题 I created a REST API using a Swagger definition, now I need to validate incoming messages using that swagger schema. I found several solutions however all of them rely on some specific use case. The closest to what I need is this and true to it's description it works well with provided json schema, however when I deliver much more complex swagger definition, it just marks everything as valid. My question is. Is there any better, more complete or competent solution, library perhaps, that would

How to describe a multipart response using OpenAPI (Swagger)?

微笑、不失礼 提交于 2019-12-20 02:34:31
问题 I have a service that creates a multipart file containing: a data byte array that represents an image buffer a JSON that represents information about the image (coord, format, etc.) Is it possible to model this custom response in an OpenAPI (Swagger) definition, using YAML? 回答1: Multipart responses can be described using OpenAPI 3.0, but not OpenAPI 2.0 (fka Swagger 2.0). openapi: 3.0.0 ... paths: /something: get: responses: '200': description: OK content: multipart/mixed: # <-- Content-Type

Following swagger specifications, how can I define json of nested objects to yaml?

北战南征 提交于 2019-12-19 19:44:57
问题 I am having a problem in defining the array of objects in swagger yaml. Swagger editor is giving an error everytime I try to define the type: array part of the yaml. I defined it, but it is not right as it is giving an error. Following is the json I am trying to define in swagger yaml. { "CountryCombo": { "options": { "option": [{ "id": "GB", "value": "GB Great Britain" }, { "id": "US", "value": "US United States" }, { "id": "AD", "value": "AD Andorra, Principality of" }] } } } I defined this