Questions tagged [openapi]

The OpenAPI Specification, originally known as the Swagger Specification, is a specification for machine-readable interface files for describing, producing, consuming, and visualizing RESTful Web services.

A variety of tools can generate code, documentation and test cases given an interface file. Development of the OpenAPI Specification (OAS) is overseen by the Open API Initiative, an open source collaborative project of the Linux Foundation.

Ref: https://en.wikipedia.org/wiki/OpenAPI_Specification

Related tags

4284 questions
13
votes
1 answer

Exact purpose of tags in OpenAPI and why are they unique

By Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all…
Sree
  • 1,694
  • 1
  • 18
  • 29
13
votes
4 answers

Refer to self in OpenAPI 3.0

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:…
GluePear
  • 7,244
  • 20
  • 67
  • 120
13
votes
2 answers

Generate Swagger YAML Open API Spec programmatically from WSDL/XML

I have a SOAP API already defined via WSDLs. Is there any tool that I can use to convert WSDL to Open API Swagger documents? I am assuming that I would need to write custom code to to create a Swagger 3.0 Open API YAML specification from an…
sandunes90
  • 455
  • 2
  • 4
  • 22
13
votes
1 answer

Swagger: take one or more values from enum

I am writing an OpenAPI (Swagger) definition where a query parameter can take none, or N values, like this: /path?sort=field1,field2 How can I write this in OpenAPI YAML? I tried the following, but it does not produce the expected result: - name:…
MrNierda
  • 412
  • 1
  • 8
  • 19
13
votes
2 answers

What is the type for currency?

I can't find a sample of currency data type in the object definition, nor a document on the subject.
vic
  • 2,548
  • 9
  • 44
  • 74
13
votes
1 answer

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

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…
lfree
  • 1,880
  • 3
  • 24
  • 39
12
votes
2 answers

How to split openAPI/Swagger file into multiple valid sub-files?

Our service implements different levels of access and we are using one openAPI YAML file internally. For external documentation purposes, we would like to create multiple openAPI files, that are valid in themselves (self-sustained), but only have a…
ErikM
  • 591
  • 1
  • 4
  • 13
12
votes
2 answers

FastAPI - Supporting multiple authentication dependencies

Problem I currently have JWT dependency named jwt which makes sure it passes JWT authentication stage before hitting the endpoint like this: sample_endpoint.py: from fastapi import APIRouter, Depends, Request from JWTBearer import JWTBearer from jwt…
lovprogramming
  • 593
  • 11
  • 24
12
votes
2 answers

Custom Grouping on OpenAPI endpoints with Django Rest Framework

I have a Django project and I am using Django REST framework. I am using drf-spectacular for OpenAPI representation, but I think my problem is not tied to this package, it's seems a more generic OpenAPI thing to me (but not 100% sure if I am right…
babis21
  • 1,515
  • 1
  • 16
  • 29
12
votes
2 answers

OpenAPI Generator Pageable with Spring

I would like the OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) to be able to generate Pageable parameter in API according to the implementation in Spring Boot Data. I've been trying to find a suitable, out of the box…
Bloodlex
  • 447
  • 2
  • 6
  • 16
12
votes
2 answers

How to create an OpenAPI schema for an UploadFile in FastAPI?

FastAPI automatically generates a schema in the OpenAPI spec for UploadFile parameters. For example, this code: from fastapi import FastAPI, File, UploadFile app = FastAPI() @app.post("/uploadfile/") async def create_upload_file(file: UploadFile…
Stefan Scherfke
  • 3,012
  • 1
  • 19
  • 28
12
votes
3 answers

How to properly document text/csv responses on swagger/yaml docs?

I have a bunch of API endpoints that return text/csv content in their responses. How do I document this? Here is what I currently have: /my_endpoint: get: description: Returns CSV content parameters: - $ref:…
theJuls
  • 6,788
  • 14
  • 73
  • 160
12
votes
1 answer

Where to put @OpenAPIDefinition?

The documentation for defining general API information using the quarkus-smallrye-openapi extension is extremely sparse, and does not explain how to use all the annotations for setting up the openApi generation. For some background, I am using a…
Snappawapa
  • 1,697
  • 3
  • 20
  • 42
12
votes
3 answers

How to add a content-type on a POST request with no body in OpenAPI 3.0?

I am trying to create an OpenAPI 3.0 definition for an existing API. It has a POST operation and takes header values as the input. Request body is empty. However the backend API was coded very poorly and is expecting request header Content-Type:…
Raj Sharma
  • 135
  • 1
  • 1
  • 8
12
votes
1 answer

What is the difference between global definitions section and components section?

What is the difference between the global definitions section and the components section in Swagger 2.0? I came across a Swagger definition YAML file which is marked as swagger: '2.0'. It has one section called definitions just below parameters.…
user3754482
  • 161
  • 2
  • 8