Questions tagged [openapi-generator]
An open-source tool to generate API clients, server stubs, documentation and more given an OpenAPI Spec (v2, v3)
903
questions
0
votes
0
answers
13
views
Generate openapi/swagger js client, without having to use npm or nodejs
I have a swagger 2.0 api specification and I would like to generate an API client in javascript for it. The issue is, that the generator I am currently using (org.openapi.generator" version '6.4....
1
vote
0
answers
14
views
How can I load data pulled from an api to gridjs in a react app
I am trying to surface the results of an api query to gridjs in a react app. I need some help in formatting the response from an openapi generated route.
This works:
function App() {
const [items, ...
0
votes
0
answers
6
views
nswag net 6 auto generated c# client
I have an .net 6 api that already uses swagger to generate the swagger UI. I am attempting to create a C# client that lives in a class library. The structure will look something like this.
...
0
votes
0
answers
29
views
Using OpenAPI Generate to Create SDK and Authorize
When using an OpenAPI spec to generate a Java SDK how do I authenticate to test out the SDK?
If I want to use these APIs in postman or in simple code I have to pass in an API token and PEM formatted ...
0
votes
0
answers
9
views
Issue generating an Angular endpoint / Model with multipart/form-data
The following is an excempt from my OpenAPI specification that I use to generate my angular services with openapi-generator-cli:
requestBody:
content:
multipart/form-data:
schema:
...
1
vote
1
answer
19
views
How do you specify the module path when using go for openapi generator?
When generating a go module with
openapi-generator-cli generate \
--input-spec ../spec/myapi.yml \
--generator-name go \
--output ./generated/go \
--package-name myapi \
--global-...
0
votes
1
answer
19
views
How to generate interfaces of models using openapi-generator-maven-plugin?
I use openapi-generator-maven-plugin version 6.4.0 and it generates to me interfaces for resources (I use configOptions - interfaceOnly), but I am getting concrete classes of models.
How can I get ...
0
votes
2
answers
41
views
Use existing class with openapi-generator-maven-plugin without skipping validation
I am using plugin openapi-generator-maven-plugin in version 6.3.0 and openapi 3.0.3 (yaml spec).
I want to use an existing model class instead of creating it by generator. I almost used the existing ...
1
vote
1
answer
41
views
OpenAPI Generator converts "no" to "false"
I created this OpenAPI YAML definition:
openapi: 3.0.3
info:
title: NonAdult API
version: 1.0.0
paths:
/api/v1/components/schemas/NonAdult:
description: 'Waiting for 3.1.0 spec to have "...
0
votes
1
answer
46
views
Default Object Parameter in swagger
I don't understand default values for object parameters in swagger. The documentation doesn't seem to have any examples.
For example:
components:
parameters:
coordinates:
in: query
...
0
votes
0
answers
54
views
openapi generator is not generating code for allOf
I'm using @openapitools/openapi-generator-cli in my project for generation of API as following:
npx @openapitools/openapi-generator-cli generate
which works fine.
Lately I had to generate the API from ...
0
votes
0
answers
59
views
How to generate client code using openapi-maven-plugin or swagger-codegen-maven-plugin in kotlin
I need to generate client's code in kotlin using swagger-codegen-maven-plugin or openapi-generator-maven-plugin. For example in Java I can set plugin library as resttemplate and I can autowire ...
0
votes
0
answers
27
views
Open api generator spring - generic return type with multiple successful http status codes
We have a service that needs can return different HTTP status codes (200 or 202) dependent on the underlying service layer. However, when we generate the code using open api generator for spring ...
-1
votes
0
answers
15
views
Immutable property in kotlin with OpenApiGenerator
What yaml directive allowed me to create a combination of mutable and immutable properties like shown below.
data class Human(
var weight: Int,
val name: String
)
Yaml file should look something ...
0
votes
0
answers
19
views
date parameter as part of path uses default date conversion for open API codegen
I am generating server code with spring boot. I am facing issue with date in path vs date in body.
If I use java8 config, my body dates are converted using jackson which uses yyyy-mm-dd
But if I put ...
0
votes
0
answers
34
views
OpenApi generator - change host by default
I need to change the host value every time when generating the Java classes.
Here is my documentation file.
swagger: "2.0"
info:
version: "0.14"
title: Some title
host: api....
0
votes
1
answer
54
views
OpenApi generator creates Enum properties with same name
My OpenApi Generator (ver. 6.4.0) for TypeScript
is producing double properties with same name in enums.
Swagger input:
"objectRole":{"type":"string","enum":[&...
0
votes
1
answer
49
views
Swagger Generate Subtypes based on enum giving an error
I have the following API input class
@JsonTypeInfo(use = Id.NAME, include = As.PROPERTY, property = "importType", visible = true)
@JsonSubTypes({@Type(value = MriImportRequest.class, name = &...
1
vote
1
answer
63
views
How to make custom Enum template using openapi-generator-cli@2.5.2
I have global installation of @openapitools/openapi-generator-cli@2.5.2 and as additional property I use enumPropertyNaming=UPPERCASE
The --addittional-properties, given by documentation https://...
0
votes
0
answers
33
views
Getting 404 when adding a Symfony bundle generated by openapi-generator
(This is probably a basic question due to my limited knowledge with both openapi-generator and Symfony, however I've spent a couple of evenings experimenting and reading docs, and I'm still stuck so I'...
0
votes
0
answers
38
views
Generate Typescript ES6 Map with OpenAPI Generator
I'm using the OpenAPI Generator (typescript-angular, but I'm also having the same issue with all other typescript generators) to generate models from a OpenAPI specification that includes:
name:
...
2
votes
1
answer
55
views
OpenAPI generator: select or skip APIs by tags
I have a big OpenAPI file with lots of methods tagged with a list of APIs, for example:
tags:
- name: Marketplace API
description: APIs used in order to use Marketplace Payment Flow
- name: ...
0
votes
1
answer
110
views
open-api-generator how to avoid fields being nullable
When I use the open-api-generator all of the fields are ? nullable, all classes look like this:
data class PagedResultDtoOfStoredDeviceFilterWithoutTermDto (
@Json(name = "currentPage")
...
0
votes
1
answer
40
views
OpenApi Genrator Import conflicts with Generated model and the library org.springframework.http.ResponseEntity. 'single-type-import' error
I have a schema named 'ResponseEntity'. The model class gets generated with the same name.
This conflicts with the ResponseEntiy class of Springframework and gives an error
error: a type with the same ...
0
votes
1
answer
47
views
How to get the message of the Bad request in API response with openAPI generated controllers in gradle spring
I have a Spring boot application (2.6.9) with gradle 7.6.
I'm using the open api generator gradle plugin to generate request controllers in my application, with the delegate pattern.
id 'org....
0
votes
0
answers
44
views
Unable to resolve subtype with InvalidTypeIdException while reading classes generated from swagger in Java
Below is the openapi code using which classes are generated:
PipelineTask:
anyOf:
- $ref: '#/components/schemas/TranslationTask'
- $ref: '#/components/schemas/ASRTask'
- $ref: '#/...
0
votes
0
answers
20
views
How to extract an "enum" from an OpenAPI 3.0.0 schema into its own class instead of creating it inside another class when generating code
I'm using the open-api-generator-maven-plugin with the spring generator to generate code from an OpenAPI 3.0.0 yaml schema file.
Inside the file there are several defined properties with an enum
...
0
votes
0
answers
20
views
Scala Swagger ArraySchema Type mismatch error
@Operation(
operationId = "GetNamesByUserIds",
description = "GET request for geting Names, returns user ids.",
parameters = Array(
new Parameter(
name ...
0
votes
1
answer
63
views
Generator does not use JDK8+ Optional if configured accordingly
Currently I'm using an OpenAPI model (3.0.2) defining some end point with data furthermore I have defined in the open API model something like this:
XYZ:
type: object
properties:
id:
...
0
votes
0
answers
18
views
Looking for Scala Play openapi(swagger) generator integrated to sbt build
I want to configure openAPI(swagger) spec as golden source for Scala Play Server.
Akka play + sbt supports out of the box "conf/routes" file. Sbt generates code base on "routes" ...
0
votes
1
answer
28
views
Using openapi-generator for typescript-angular, how to generate just a module inside an existing Angular project instead a full separate package?
I am using openapi-generator for typescript-angular.
I can successfully generate an Angular module, with all artifacts, however it is a separate npm package.
I do understand, that this approach has ...
0
votes
0
answers
23
views
How to update user information properly, using spring boot and openAPI?
I have UserController that signs up and updates information about user:
@RestController
@RequiredArgsConstructor
public class UserController implements UserApi {
private final UserService ...
0
votes
1
answer
84
views
Unresolved reference when using openApiGenerate build.gradle.kts
I'm trying to get openapigenerator to help get responses automatically from a swagger for my mocked api. the build.gradle.kts looks like this
buildscript {
repositories {
mavenLocal()
...
0
votes
1
answer
67
views
Openapi generator to generate JsonNode type variable
I have a following object definition in OpenApi v3.0.3. I am using java 17 + gradle with build.gradle.kts in Kotlin
customPayload:
type: object
nullable: true
example:
...
0
votes
0
answers
55
views
Openapi-Generator creates wrong typescript having polymorphism
I have the following DTOs:
public class InvoiceCreate{
pubilc IEnumerable<ProductCreate> Products{get;set;}
}
public abstract class ProductCreate{
public int number{get;set}
public ...
0
votes
1
answer
47
views
OpenApi specification generator - Supply values from multiple Enum classes for a String field
I'm writing a Spring Boot application in Kotlin, and I'm currently struggling to generate a specification for a DTO class that has a backing field of the type String, which I want to then later parse ...
0
votes
0
answers
36
views
"Could not find method wrapper()" in build.gradle file generated by openapi-generator kotlin client
I have a simple spring boot project using the kotlin gradle dsl. I want to generate an OpenApi client using the openapi client generator gradle Plugin. I have successfully done so, using this ...
0
votes
0
answers
30
views
Accessing common openapi schema file in another bazel target
I'm using https://github.com/OpenAPITools/openapi-generator-bazel and I have a common schema that is referenced by multiple other openapi targets throughout our codebase. To reference members of the ...
0
votes
2
answers
35
views
What's the quickest way to get an OpenAPI spec for existing web service
I have a running web server that uses restful API as its backend, wondering what is the most effective way to get the OpenAPI spec with the full set of APIs
just exploring ideas
-1
votes
1
answer
66
views
Override Function from Another Module in Golang
How do you override a function created in another module in Golang?
Module A
In one module I have the function NewPersonApiService, the full code is laid out as below:
package openapi
import (
&...
1
vote
1
answer
53
views
How can I generate json specification file dynamically with open api in Angular?
I have used Swgger ui like below code and now I want to create pet.json dynamically
export class AppComponent {
ngOnInit() {
SwaggerUI({
domNode: document.getElementById('swagger-ui-item'...
0
votes
0
answers
90
views
openapi-generator typescript omit empty object type
There are certain properties I need to omit from the idl and after that I got something in the openapi spec json file like
{
...
components: {
...
"compA": {
"type&...
2
votes
1
answer
76
views
The line import openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" is added when generating from openapi-generator prompts login
I am using openapi generator to generate my rest api client. It generates the line
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
In my imports but I can't for the life of me understand ...
0
votes
1
answer
118
views
Cannot generate a KMP library correctly and use it in a KMM library project
I am currently working on a project that implements the following steps:
generation of a KMP project for an API using open api generator and a swagger description file
package the common, jvm and iOS ...
2
votes
1
answer
92
views
How to fetch an OpenAPI YAML file from a private GitHub repository through token in settings.xml using OpenAPI Generator?
Here is the pom.xml:
<plugin>
<artifactId>openapi-generator-maven-plugin</artifactId>
<executions>
<execution>
<...
0
votes
1
answer
42
views
Multipart don't working for ArrayObject files with Open Api 4.3.1 Version
Description
Hi Everyone. I am working with open api generator and change for only use Reactor in my projects (Flux and Mono). My problem is when I generate Multipart form for object array files, the ...
0
votes
1
answer
125
views
openapi codegen without fromJson and toJson methods
I am using openapi-generator-maven-plugin to generate model sources. With my current configuration it generates methods called fromJson and toJson for every model class.
Is there a way to configure ...
2
votes
2
answers
108
views
openapi codegen without access methods
I am using the openapi-generator-maven-plugin to generate model sources.
Is there a way to generate them only with fields and without any access methods?
I want the access methods to be generated via ...
0
votes
0
answers
38
views
Openapi genearter online : (through reference chain: org.openapitools.codegen.online.model.GeneratorInput["authorizationValue"]
I am traying to run openapi-generater-online in local machine as SpringBoot Project But getting error while Running api/gen/servers/spring
Error in Terminal
Cannot construct instance of java.util....
1
vote
0
answers
49
views
Implement Python Flash Controller Methods Generated from OpenAPI Generator
I'm using OpenAPI Generator to generate a Python Flask web app from an OpenAPI specification. A generated controller method looks like this:
def doStuff(body): # noqa: E501
return 'do some magic!...