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.
3,393
questions
0
votes
0
answers
9
views
Generate only models using Swagger-api / swagger-codegen
Generating the typescript-angular files from the downloaded jar swagger-codegen-cli-3.0.34.jar
Command
java -jar tools/swagger-codegen-cli-3.0.34.jar generate \
-i http://localhost:8080/swagger/fete-...
0
votes
0
answers
11
views
Springdoc UI append application port behind reverse proxy
I use SpringDoc
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.9</version>
</dependency>
...
0
votes
1
answer
18
views
Custom API Key Authentication method in .net core not working on controller
I am trying to create an ASP.NET Core Web API for the first time. I am trying to use API key based authentication to call the methods, where users need to pass the authentication key in the HTTP ...
0
votes
0
answers
25
views
FastAPI swagger & redoc Unable to render this definition in python
I'm using python for fastapi implementation so when I try to open docs it shows the following error.
Below is the code, how i'm creating the fastapi object.
app = FastAPI(title=settings.PROJECT_NAME, ...
0
votes
0
answers
11
views
Shall I use oneOf or multiple attributes on the same object for a component of OpenAPI specification?
In short, here's fragment of OpenAPI specification:
# Consider an imaginary Internet Service Provider that needs to limit
# one or multiple customers in different ways: bandwidth (inbound, outbound), ...
0
votes
0
answers
19
views
C# Azure Function OpenAPI
I have written an Azure Function on .NET Core 3.1. I am trying to generate the OpenAPI specification from the code. I cannot figure out if/how its possible to customize the display name of the schemas ...
0
votes
0
answers
22
views
OpenAPI v3 discriminator definitions are letting invalid mapping entries through
We have an application where we need to allow any one of a handful of different kinds of applications to be managed through common endpoints. While (I think) I have all the definitions set up ...
0
votes
0
answers
19
views
How to pass multi dimension array into swagger?
I am using "nelmio/api-doc-bundle" 4.9 and I need to pass multi-dimenional array using swagger. In postman I am passing like this.
So far, I have tried this in swagger.
* @OA\Parameter(
* ...
1
vote
0
answers
17
views
Possibility of omitting default value for enum and excluding some enum properties from the OpenAPI spec
In order to create an OpenAPI spec for the Azure Functions I have been developing, I have used a library, which enables Azure Functions to render OpenAPI document and Swagger UI.
Generally, it works ...
1
vote
1
answer
17
views
NSwag For ServiceStack
I would like to use NSwag for generating OpenApi v3 Spec for ServiceStack(SS) based application. With SS, the contracts are defined in DTO type class and the implementations in another class making it ...
0
votes
0
answers
19
views
How to use ref of schema as oneOf/anyOf responses of an endpoint using springdoc-openapi?
I'm using springdoc-openapi and I defined a few schemas using one of my classes (so they don't have individual classes). I've defined them using addSchemas in OpenAPI bean as mentioned in this issue:
...
1
vote
0
answers
33
views
OpenApi design first problems [closed]
we selected design first and we are using openApi. We faced with:
no generic types in open api
i cant specify:
Pageable:
type: object
properties:
objects:
type: <GenericType>
...
0
votes
0
answers
36
views
Custom constraint in OpenAPI Specification 3.0.0 (java)
In the project we use open api 3.0. I need to write a custom validator for JsonNullable value...
specification:
Characteristic:
type: object
required:
- name
- value
...
1
vote
0
answers
14
views
Generate openapi 3 shared request and response components with drf-spectacular
Is there a way to generate openapi shared response and request objects using drf-spectacular?
In the resulting JSON, I would expect to see "$ref": "#/components/responses/ErrorResponse&...
0
votes
0
answers
23
views
swagger file generation issue of gradle openapi-generator v6.0.1, wrong filename being generated
Do anyone encounter this?
Problem: ApiError from swagger file is being generated to APIError.java but the class name itself is correct and same to ApiError. Small letters "p" and "i&...
1
vote
1
answer
29
views
How to have multiple body parameters in OpenAPI 2.0 (Swagger 2.0)?
I would like to have multiple parameters in the request body like below, but the Swagger Editor says "Multiple body parameters are not allowed". How to have a combination of both object and ...
0
votes
0
answers
35
views
Is there a way to set up openapi examples in protobuf?
I am using gnostic to output openapiv3 yaml files from protobuf.
Furthermore, I am setting up a Mock server from openapiv3 using Prism, but I want to use the response from the examples specified.
Is ...
0
votes
1
answer
35
views
Reading a swagger data in Python
I'm trying to get the properties for each definitions found in swagger file (2.0) using python.
so far I was able to get some data using the example from here but still trying to access the data in ...
0
votes
0
answers
9
views
Role authorization configuration in openAPI specs
We are creating openAPI for our services. These services are protected by the JWT token that is sent in the authorization header. In that JWT, we have claims related to roles. Depending on the role, ...
0
votes
2
answers
54
views
Generate models and end-point using swagger specification with mironaut 3.6.0 and angular application 14
I have two separate applications, one is Micronaut using Java and Angular 14. They are two independent applications. Using the benefit of open API I am generating the Swagger UI using Micronaut ...
1
vote
1
answer
54
views
How to add image to Swagger UI autodocs using FastAPI?
I would like to add an image to the FastAPI automatic documentation (provided by Swagger UI), but I can't figure out how to do this.
This is the code:
@api.get(path='/carbon-credit/',
responses={
...
1
vote
1
answer
22
views
How to write an OpenAPI schema for a nested arrays with mixed type values?
My API returns the response in following format:
[
[
"Time",
"Attempts",
"Successes",
"Failures",
"BookabilityRatio"
],
[
...
-1
votes
0
answers
13
views
Can I define nested objects in Swagger 2.0?
Request JSON:
{
"data": {
"organizationsName": "string",
"workspacesName": "string",
"usersName": "string",
&...
0
votes
0
answers
22
views
ResolveFully option does not resolve all schemas in some paths
Swagger-parser version: 2.1.1
Example swagger spec:
The test case is quite large, so I put it in a github gist. Don't be surprised by the names of the paths and schemes - I masked the critical data.
...
-2
votes
0
answers
11
views
Model class is not generating in swagger 2.0 and 3.0 for Array of Objects (JsonArray includes multiple JsonObject) in Java [closed]
TextUpdate:
type: array
items:
type: object # <----------
properties: # <----------
Name:
type: string
Text:
type: string
Number:
type: string
Content-type:
type: stringenter image ...
0
votes
0
answers
20
views
Quarkus - Generate rest clients from OpenApi
I'm using Quarkus with Kotlin and tried to generate Rest clients using this Quarkus extension https://github.com/quarkiverse/quarkus-openapi-generator.
I included the dependency and the mentioned ...
1
vote
0
answers
28
views
How to use initializeMiddleware of oas tools to add customized properties to the HTTP request?
I am trying to replace the existing swagger tools in my project with oas-tools.
Source code shown as follows
const express = require('express');
const swaggerTools = require('swagger-tools');
const ...
1
vote
1
answer
61
views
Rest API with same HTTP status code, different error responses for one endpoint
We are developing our microservices using Spring Boot and OpenAPI.
Each endpoint could possibly return many business exceptions (an errorCode) and their HTTP Status Codes are all the same (say 400).
...
0
votes
0
answers
30
views
Spring boot -Open api 3 doc generation dynamically without maven and restarting application (swagger Interceptor implementation)
I am using spring boot in which I wanted to dynamically generate open api 3 specification by uploading json/yml and view in swagger ui
upload json/yml
dynamically generate swagger /open api ...
0
votes
0
answers
15
views
Swagger AWS API Gateway with Strict-Transport-Security
I'm trying to use Strict-Transport-Security header with API Gateway on swagger definition, but I keep getting Invalid mapping expression parameter specified: method.response.header.Strict-Transport-...
1
vote
1
answer
35
views
How to use multiple references in OpenAPI 3 yaml file's paths section?
I try to organize my one giant OpenAPI yaml file into several small pieces and then bundle it with swagger-cli. And I run into the paths section.
This is my openapi.yml file now:
openapi: "3.0.0&...
0
votes
2
answers
34
views
Swagger: Unable to find model that actually exists
I'm using Spring Boot v2.6.0 to create a simple hosting service.
For Swagger I'm using SpringFox version 3.0.0, and Swagger2.
As I've never used Swagger or OpenAPI inside my Spring projects I'm out of ...
0
votes
0
answers
9
views
OpenAPI Spring how to not generate all query parameters
in our project we are using OpenAPI with Spring MVC.
There we have some query parameters which are used in the filter chain, but not in the actuall controller like language.
Now my "problem" ...
1
vote
0
answers
42
views
+50
Spring Rest Controller API with HttpEntity getting null body when testing with Open API
I'm using Spring Boot 2.6.7 and Using Open API springdoc-openapi-ui 1.6.4. I have 2 services. From first service I'm using rest template to connect to second service.
In the first service, in rest ...
1
vote
1
answer
33
views
How to display all of the oneOf schemas in Swagger UI?
I have an OpenAPI document where an endpoint uses oneOf for the request body (this endpoint has 2 possible different schemas). In Swagger UI, I can only see one of the schemas where the endpoint is ...
0
votes
0
answers
21
views
title case lambda not working in OpenApi Generator mustache templates
I'm using Mustache templates with the spring OpenAPI Generator to generate Java interfaces from an OpenAPI spec.
I'm trying to make them generate @GetMapping, @PostMapping instead of using ...
0
votes
0
answers
32
views
How to group REST API in micronaut?
I use Micronaut @Version to implement my REST API Versioning strategy, and I use header X-API-VERSION to carry the version number, but I don't know how to group different version of REST API endpoints ...
0
votes
0
answers
26
views
OpenAPI: combine JAXB and JSON (WRAPPER_OBJECT) correctly?
OpenAPI: combine JAXB and JSON (WRAPPER_OBJECT) correctly?
Dear community,
I'm a beginner with swagger/openapi. I want write Java classes with annotations and generate
documentation by OpenAPI library....
0
votes
0
answers
21
views
Generate enum with open API 3.0
i have the below section in my yaml file for which i need corresponding enums generated. I intend to use the "somemap" as a response for the API.
somemap:
type: object
...
0
votes
1
answer
34
views
Schema from drf-yasg for nested serializers
I built nested serializer where ModelSerializer include another serializer as field. Everything works well but in swagger docs in example body parameters I don't see openning_time field. What can I ...
0
votes
1
answer
41
views
Code generated by openapi-generator always sends empty arrays when uniqueItems = true in openapi documentation
I made a REST endpoint and an open-api documentation for it using SpringDoc+Swagger. Request body of endpoint has a field - set of objects. As I see in generated documentation, it's the same thing as ...
0
votes
0
answers
41
views
springdoc-openapi-ui swagger 3 swagger-ui.html is throwing 302 and redirecting to some other page that doesn't exist
We migrated springfox to springdoc-openapi-ui and changed the configuration as mentioned in the documention.
Documentation - Springfox to openAPI and swagger ui is served behind a proxy. For that ...
0
votes
0
answers
21
views
Swagger: How to change example header value
I'm using OpenAPI Spec + Spring Restdocs + swagger.
@Test
public void test() throws Exception {
this.mockMvc.perform(get(PATH)
.header(HEADER_NAME, "aabbcc"))
...
0
votes
0
answers
39
views
+50
Cannot read internal property of multipart/form-data for swagger( openapi: "3.0.0")
I am creating an express api and documenting it using swagger jsdoc
my model looks like this
Property Model :
{
name : "string",
address : {
street : "string",
pincode : "...
0
votes
1
answer
40
views
How to add context path in the swagger ui / open api in try it out
I am using springdoc-openapi-ui for documenting my REST end point.
Below is the pom dependency
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-...
0
votes
0
answers
34
views
OpenApi 3.0 Enum values structure
I am using OpenApi 3.0 and I have encountered a requirement with enum with some extra fields.
Example:
enum:
- name: a
x-field-uid: 1
description: some description
- name: b
x-field-...
0
votes
0
answers
23
views
Using open-api typed query parameters with express JS
With a parameter like:
- name: flag
in: query
required: false
schema:
type: boolean
The parameter received on my node-js express server is a string, not a boolean - despite the typings ...
0
votes
0
answers
16
views
Swagger API key? Do i need to insert my API key to make a gen a client? Im trying to use python to interact with the api, but i need to gen the code
I have a key, but I have no idea where to put it. In the swagger file that will generate the python code? I'm new to APIs. I have inserted the key into the "header":[] and "query":[...
0
votes
1
answer
28
views
Swagger 3 generates Properties with missing type if type is missing in OpenApi-Specification
I try to generate c# code out of an openApi specification which is missing the type element on some properties with swagger 3.
The properties with missing type are generated in code also without type,...
0
votes
1
answer
40
views
Customize schema names in Swashbuckle
I use generic type to share common properties in my response types, but I don't like the way Swashbuckle generates schema types from generic type (it concatenates the name of the type parameter in ...