swagger-2.0

Django REST Framework Swagger 2.0

耗尽温柔 提交于 2019-12-02 19:21:41
Having a hard time configuring Swagger UI Here are the very explanatory docs: https://django-rest-swagger.readthedocs.io/en/latest/ YAML docstrings are deprecated. Does somebody know how to configure Swagger UI from within the python code? or what file should I change to group api endpoints, to add comments to each endpoint, to add query parameter fields in Swagger UI? This is how I managed to do it: base urls.py urlpatterns = [ ... url(r'^api/', include('api.urls', namespace='api')), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), ... ] api.urls.py urlpatterns

How to generate swagger.json

流过昼夜 提交于 2019-12-02 19:01:07
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. You can get the url with your swagger-ui html page: GET http://localhost:8080/v2/api-docs?group=App And actually you can get all the urls with chrome/firefox develop

Hidden fields in swagger ui

喜你入骨 提交于 2019-12-02 15:16:08
问题 I am using swagger UI 2.0.23 version and I provision api using json files. I need to send a particular header value to my api using swagger ui but the field should not be visible in the ui. Because the value is not supposed to be changed. Therefore how do I hide the field from showing in the ui. I have tried following sample but didn't work { "name": "access_type", "dataType": "string", "enum": [ "high" ], "required": "true", "paramType": "httpHeader", "access": "hidden" } 回答1: This is all

How to keep the single resource representation approach using OpenAPI spec

只谈情不闲聊 提交于 2019-12-02 08:18:48
Reading this post (see: 3 How to use a single definition when... ) about describing a REST API using OpenAPI (Swagger) specification you can note how to keep a single resource representation for adding/updating and getting resource using readOnly property instead of having one representation for getting (GET a collection item) and other one for adding (POST to a collection). For example, in the following User single representation, the id is a read-only property which mean that it won't be sent in the representation when a user is created, it will be there when a user is retrieved. "User": {

Web API Documentation using swagger

ⅰ亾dé卋堺 提交于 2019-12-02 07:34:39
问题 I am new to swagger, I have seen couple of online documentation to implement Swagger to my webapi and used some of the properties of SwaggerConfig to customize. Here is my requirement :- I need to show swagger documentation only on "Explore" button click based on the value of "API_Key" TextBox which should match with my app.config key. So I am seeing to implement like this:- User comes to my swagger home page, by default it will have empty documentation, except the header as shown in the

Web API Documentation using swagger

泄露秘密 提交于 2019-12-02 04:25:11
I am new to swagger, I have seen couple of online documentation to implement Swagger to my webapi and used some of the properties of SwaggerConfig to customize. Here is my requirement :- I need to show swagger documentation only on "Explore" button click based on the value of "API_Key" TextBox which should match with my app.config key. So I am seeing to implement like this:- User comes to my swagger home page, by default it will have empty documentation, except the header as shown in the image. Enters API_Key in the textbox provided in the header and click on Explore. Entered API key is

Swagger- Schemes HTTP and HTTPS with different ports

二次信任 提交于 2019-12-02 04:08:58
How does one specify multiple schema with different ports? Specifically, I want to have HTTP on port 81 and HTTPS on port 444. swagger: '2.0' info: version: 1.0.0 title: API for gateways description: API for gateways to access server (port 81 for http and 444 for https) schemes: - http - https host: gateway.example.com:81 basePath: /1.0 paths: This is possible in OpenAPI 3.0, but not in OpenAPI/Swagger 2.0. openapi: 3.0.0 servers: - url: 'http://gateway.example.com:81' - url: 'https://gateway.example.com:444' 来源: https://stackoverflow.com/questions/48303541/swagger-schemes-http-and-https-with

Swagger UI Multi level tagging

瘦欲@ 提交于 2019-12-02 02:37:54
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 ---------->Heading2 --------->SubHeading1 --------->Desc3 --------->SubHeading1 --------->Desc4 How do i achieve

How to specify a property can be null or a reference with swagger

巧了我就是萌 提交于 2019-12-01 17:17:01
How to specify a property as null or a reference? discusses how to specify a property as null or a reference using jsonschema. I'm looking to do the same thing with swagger. To recap the answer to the above, with jsonschema, one could do this: { "definitions": { "Foo": { # some complex object } }, "type": "object", "properties": { "foo": { "oneOf": [ {"$ref": "#/definitions/Foo"}, {"type": "null"} ] } } } The key point to the answer was the use of oneOf . The key points to my question: I have a complex object which I want to keep DRY so I put it in a definitions section for reuse throughout my

How to specify a property can be null or a reference with swagger

青春壹個敷衍的年華 提交于 2019-12-01 16:35:50
问题 How to specify a property as null or a reference? discusses how to specify a property as null or a reference using jsonschema. I'm looking to do the same thing with swagger. To recap the answer to the above, with jsonschema, one could do this: { "definitions": { "Foo": { # some complex object } }, "type": "object", "properties": { "foo": { "oneOf": [ {"$ref": "#/definitions/Foo"}, {"type": "null"} ] } } } The key point to the answer was the use of oneOf . The key points to my question: I have