swagger-editor

How to add several examples to response in Swagger without breaking Codegen?

人盡茶涼 提交于 2019-12-11 13:15:30
问题 I've been trying to add examples to my Swagger API according to the official docs (see last codeblock of Request and Response Body Examples ) but it does not seem to work as expected. Considering the following minimal example: swagger: "2.0" info: description: Desc version: "1" title: Title paths: /stuff: post: produces: - application/json responses: 201: description: It worked content: application/json: schema: $ref: "#/definitions/StatusMessage" examples: Success without message: value:

Swagger Schema error should NOT have additional properties

时间秒杀一切 提交于 2019-12-11 08:52:44
问题 I am trying to create swagger json and trying to check it's validity in http://editor.swagger.io Upon validating the json, the above mentioned editor gives the following error: Schema error should NOT have additional properties additionalProperty: components Jump to line 0 If for some reason I can't define an element named components at root level where i am going to have some sort of json schema, what is the right way to do a $ref on the schema for requestBody for an API operation as I

Swagger create API document: Swagger Editor

淺唱寂寞╮ 提交于 2019-12-11 06:34:52
问题 I am using swagger for documenting my REST API service. I have an specific input that I provide to the service. I am creating YAML code by myself using swagger editor. The issue I am facing is I am not able to get the input type as XML, it by default takes JSON. Is there any issue in my yaml code. The code is given below: swagger: "2.0" info: title: Order Update to Dealers description: API description in Markdown. version: 1.0.0 host: #Host name cannot be specified here basePath: /api

Remove petstore spec when starting swagger editor

守給你的承諾、 提交于 2019-12-10 20:07:43
问题 I am using Swagger Editor locally in my machine. When I start the Swagger Editor, it shows the spec for petstore by default at startup. I want to remove that and show a blank editor. Is there a way to do that at startup. 回答1: A simple workaround is to run the editor with the ?url= parameter where the URL points to an empty page (no HTTP response body), such as http://httpbin.org/status/200. http://editor.swagger.io/?url=http://httpbin.org/status/200 This will open a blank editor.

Swagger UI - can't enable JSON editor for the request body

强颜欢笑 提交于 2019-12-10 19:44:05
问题 I have some issue to make it work, according to following link below, the JSON editor for the request body (disabled by default). https://github.com/jensoleg/swagger-ui How can I enable it? 回答1: I found the solution. Add the following into index.html in the new SwaggerUi({}) constructor: docExpansion: "none", sorter: "alpha", jsonEditor: true, defaultModelRendering: 'schema', showRequestHeaders: true 来源: https://stackoverflow.com/questions/37441859/swagger-ui-cant-enable-json-editor-for-the

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

How to use Cookies in Swagger editor

旧街凉风 提交于 2019-12-08 21:00:53
问题 I would like to document and test an API, which uses Cookie-based authetication in http://editor.swagger.io/. To give a simple example: How to write in the following YAML, that /login action creates a Cookie and the Cookie has to be passed to /showMySecretStuff? swagger: '2.0' info: title: Test API version: '1' host: my.test.com schemes: - https basePath: / consumes: - multipart/form-data produces: - application/json paths: /login: post: parameters: - name: username in: formData required:

Change the default package name in Swagger Editor for java project

非 Y 不嫁゛ 提交于 2019-12-08 06:18:59
问题 I have downloaded the Swagger Editor and run it locally from localhost:3001 . I imported my .yaml file from local system. Then I clicked on Generate Server and I choose a jaxrs . When I opened a random java file I can see: package io.swagger.model; I have more then 30 java classes and I don't want to change it manually, because my .yaml maybe change in future. Is there any possibility to change it, to be for example: package my.funny.package.model; //Edit: I downloaded Swagger Editor from

Swagger: Add description with ref

孤者浪人 提交于 2019-12-06 21:25:56
问题 I want to add a description to an object property that his definition is referenced. Something like that: newCreditCard: type: object properties: billingPhone: description: Phone number of the card holder $ref: "#/definitions/PhoneNumber" But the editor warns that the description property will be skipped: Extra JSON Reference properties will be ignored: description I have found a less elegant workaround that works for the editor, but not for the Swagger UI (not sure that is may due to the

Swagger Editor offline installation

帅比萌擦擦* 提交于 2019-12-06 03:35:30
问题 Our company is using swagger to document their API's, currently a couple of developers are using the online swagger editor on their PC's. I want to move this piece of the design process into our standard development environment, which is in a walled garden without internet access. How do I go about installing npm and the swagger editor in an offline environment? There are options to use either RHEL or Windows machines, although Windows is preferable as developers have local admin rights 回答1: