openapi

open api 3 posting an array of files

断了今生、忘了曾经 提交于 2019-12-08 19:02:28
I am using swagger hub to create this API ; but it doesn't support multi files in the UI so I am unsure if I am doing this right My goal is to have the following item:{Json describe the item} images[] = images for item posted as an array titles[] = Parallel array to images that has the title for image alt_texts[] = Parallel array to images that has the alt text for image This has to be multipart since it is files; but am unsure if I setup the structure correctly. Swagger/Open API Code post: summary: Add a new item to the store description: '' operationId: addItem requestBody: content:

Generating swagger docs from typescript interfaces

喜你入骨 提交于 2019-12-08 10:44:08
问题 I'm using swager-jsdoc to document all the DTOs of the app. I was wondering is there any way to generate the swagger docs automatically from typescript interfaces. I have a lot of them in the project and also a lot of mongoose schemas and models. It is getting tedious to keep them in sync. On the other hand I do not want to use the swagger generation tools. I prefer the bottom-up approach. Cheers 回答1: Yes, you can easily generate Swagger and OpenAPI documents from your TypeScript types by

open api 3 posting an array of files

回眸只為那壹抹淺笑 提交于 2019-12-08 05:57:32
问题 I am using swagger hub to create this API; but it doesn't support multi files in the UI so I am unsure if I am doing this right My goal is to have the following item:{Json describe the item} images[] = images for item posted as an array titles[] = Parallel array to images that has the title for image alt_texts[] = Parallel array to images that has the alt text for image This has to be multipart since it is files; but am unsure if I setup the structure correctly. Swagger/Open API Code post:

Generate a Swagger file for certain endpoints from another Swagger or OpenAPI file

佐手、 提交于 2019-12-07 23:57:50
问题 Having one big Swagger/OpenAPI YAML specification, how can I safely extract certain API endpoints and generate a new .yaml for them exclusively? It's easy to identify API endpoints from a certain level (like defined with one indent or more): paths: /users: ... - $ref: '#/requests/getUser' /repos: ... requests: getUser: ... I'd just copy all sections, except paths , into a new specs file. And then I'd copy certain paths subsections like /users: based on indents. In Python, with a regex. But is

Refer to self in OpenAPI 3.0

醉酒当歌 提交于 2019-12-07 17:55:22
问题 I have a data model definition in OpenAPI 3.0, using SwaggerHub to display the UI. I want one of the properties of a model to be related , which is an array of properties of the same model. Foo: properties: title: type: string related: type: array items: $ref: '#/components/schemas/Foo' The parser doesn't seem to like this - the UI shows the related property as an empty array. Is this kind of self-reference possible in OpenAPI 3.0? 回答1: Your definition is correct, it's just Swagger UI

How to define an array of another schema in OpenAPI 3? [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-07 17:12:29
问题 This question already has an answer here : Return an array of object in Swaggerhub (1 answer) Closed last year . I have this schema defined: User: type: object required: - id - username properties: id: type: integer format: int32 readOnly: true xml: attribute: true description: The user ID username: type: string readOnly: true description: The username first_name: type: string description: Users First Name last_name: type: string description: Users Last Name avatar: $ref: '#/components

How to define UUID property in JSON Schema and Open API (OAS)

北城余情 提交于 2019-12-06 20:38:58
问题 When using JSON Schema and Open API specification (OAS) to document a REST API, how do I define the UUID property? 回答1: There's no built-in type for UUID, but the OpenAPI Specification suggests using type: string format: uuid From the Data Types section (emphasis mine): Primitives have an optional modifier property: format . OAS uses several known formats to define in fine detail the data type being used. However, to support documentation needs, the format property is an open string-valued

Tell Swagger that the request body can be a single object or a list of objects

流过昼夜 提交于 2019-12-06 20:26:14
问题 I am using Swagger with Scala to document my REST API. I want to enable bulk operations for POST, PUT and DELETE and want the same route to accept either a single object or a collection of objects as body content. Is there a way to tell Swagger that a param is either a list of values of type A or a single value of type A? Something like varargs for REST. 回答1: Is there a way to tell Swagger that a param is either a list of values of type A or a single value of type A? This depends on whether

How to include Http request method name in client method names generated with NSwag

ぐ巨炮叔叔 提交于 2019-12-06 15:27:01
When I generate a C# client for an API using NSwag, where the API includes endpoints that can be used with multiple Http request types (e.g. POST, GET) the client generates a method for each request with the same base name, plus a number. E.g. Using this API: https://api.premiumfunding.net.au/assets/scripts/swagger/v1/swagger.json The schema contains an endpoint /contract that supports GET and POST requests, and an endpoint /contract/{ID} that supports GET , POST and DELETE requests. The generated client has methods: ContractAsync for GET requests without ID Contract2Async for POST requests

Generate a Swagger file for certain endpoints from another Swagger or OpenAPI file

旧时模样 提交于 2019-12-06 07:15:42
Having one big Swagger/OpenAPI YAML specification, how can I safely extract certain API endpoints and generate a new .yaml for them exclusively? It's easy to identify API endpoints from a certain level (like defined with one indent or more): paths: /users: ... - $ref: '#/requests/getUser' /repos: ... requests: getUser: ... I'd just copy all sections, except paths , into a new specs file. And then I'd copy certain paths subsections like /users: based on indents. In Python, with a regex. But is this direct method safe for the specs? Swagger Inspector lets you make API calls and then create the