openapi

What is the correct way to declare a date in an OpenAPI / Swagger-file?

蹲街弑〆低调 提交于 2019-12-03 15:04:13
问题 What is the correct way to declare a date in a swagger-file object? I would think it is: startDate: type: string description: Start date example: "2017-01-01" format: date But I see a lot of declarations like these: startDate: type: string description: Start date example: "2017-01-01" format: date pattern: "YYYY-MM-DD" minLength: 0 maxLength: 10 Thanks. 回答1: The OpenAPI Specification says that you should use: type: string format: date # or date-time The pattern to use is defined in RFC 3339,

What is the 'scopes' field of the swagger security scheme object used for?

冷暖自知 提交于 2019-12-03 12:50:05
petstore_auth: type: oauth2 authorizationUrl: http://swagger.io/api/oauth/dialog flow: implicit scopes: write:pets: modify pets in your account read:pets: read your pets This is a securityDefinitions example from the Swagger Specification . What does the write:pets and read:ptes intended for? Is that some categories for the paths? write:pets and read:pets are Oauth2 scopes and are not related to OpenAPI (fka. Swagger) operations categorization . Oauth2 scopes When an API is secured with Oauth, scopes are used to give different rights/privilege to the API consumer. Scopes are defined by a name

【开源】.Net Api开放接口文档网站

孤街浪徒 提交于 2019-12-03 11:34:14
开源地址: http://git.oschina.net/chejiangyi/ApiView 开源QQ群: .net 开源基础服务 238543768 ApiView .net api的接口文档查看网站,用于解决 分布式开发 过程中的Api接口管理和沟通问题。 - 自动生成api文档; - 方便api调试及第三方开发人员对接,可以应用在asp.net mvc,wcf,webservice 中使用; - 代码及原理都很简单,方便二次开发和完善。 by 车江毅 安装包 使用git下载项目并打开目录 “\安装包\” 可直接安装使用 使用Demo示例 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using System.Web.Mvc; 6 using BSF.BaseService.OpenApi.Attributes; 7 using BSF.Extensions; 8 using BSF.Api; 9 10 namespace ApiViewTestWeb.Controllers 11 { 12 public class DemoController:Controller 13 { 14 // 15 // GET: /Demo/ 16

Django REST Framework Swagger 2.0

南笙酒味 提交于 2019-12-03 05:02:53
问题 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? 回答1: This is how I managed to do it: base urls.py urlpatterns = [ ... url(r'^api/', include('api.urls', namespace='api')),

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 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": {

Creating an extendible model using Swagger/ OpenAPI

被刻印的时光 ゝ 提交于 2019-12-02 00:02:35
问题 In my API i would like to have a simple model for my collection and a more elaborate model for my individual resource. For example: a GET request on /libraries should return BaseLibrary: type: object properties: library_id: type: string description: The id of the library display_name: type: string description: Name of the library href: type: string description: The URI linking to this library. whilst a request to a specific library should return all of the above including an extra parameter

Creating an extendible model using Swagger/ OpenAPI

流过昼夜 提交于 2019-12-01 22:47:21
In my API i would like to have a simple model for my collection and a more elaborate model for my individual resource. For example: a GET request on /libraries should return BaseLibrary: type: object properties: library_id: type: string description: The id of the library display_name: type: string description: Name of the library href: type: string description: The URI linking to this library. whilst a request to a specific library should return all of the above including an extra parameter books: So a GET request to libraries/{library_id} should return: ExtendedLibrary: type: object

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

霸气de小男生 提交于 2019-12-01 20:34:57
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? 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 of the response schema: type: object properties: # Part 1 - application/octet-stream file: # <-- part name

Swagger Codegen (with maven plugin) for OpenAPI 3.0

你说的曾经没有我的故事 提交于 2019-12-01 16:06:11
I want to use Swagger Codegen for OpenAPI 3.0 YAML file. And I see Swagger Codegen 3.0.0-rc0 is available. But when I try to use that I run into issues. Following are the details: My pom.xml file with swagger-codegen plugin: <plugin> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>3.0.0-rc0</version> <executions> <execution> <goals> <goal>generate</goal> </goals> <configuration> <inputSpec>${basedir}/src/main/resources/mySpec.yaml</inputSpec> <output>target/generated-sources</output> <language>spring</language> <generateApis>false</generateApis>