Skip to content

Instantly share code, notes, and snippets.

@mvanglabbeek
Created February 15, 2023 13:36
Show Gist options
  • Save mvanglabbeek/30951b64448e74f8a8182e2f0b57e995 to your computer and use it in GitHub Desktop.
Save mvanglabbeek/30951b64448e74f8a8182e2f0b57e995 to your computer and use it in GitHub Desktop.
Demo for issue openapi-generator-maven-plugin 6.3.0 toUrlQueryString(String)
openapi: 3.0.1
info:
title: swagger-server
description: Demo API
version: "1.0"
paths:
/api/all:
get:
summary: Retrieve All
operationId: getAll
responses:
"200":
description: Found stuff
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/DemoObject'
components:
schemas:
ArrayItem1:
required:
- name
type: object
properties:
field1:
type: integer
format: int32
name:
type: string
ArrayItem2:
required:
- name
type: object
properties:
field2:
type: string
name:
type: string
ArrayItem:
required:
- name
type: object
properties:
name:
type: string
discriminator:
propertyName: name
anyOf:
- $ref: '#/components/schemas/ArrayItem1'
- $ref: '#/components/schemas/ArrayItem2'
DemoObject:
type: object
properties:
property1:
type: boolean
arrayItems:
type: array
items:
$ref: '#/components/schemas/ArrayItem'
<!-- only the openapi-generator-maven-plugin part -->
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>6.3.0</version>
<configuration>
<generatorName>java</generatorName>
<library>native</library>
<generateApis>false</generateApis>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModelDocumentation>false</generateModelDocumentation>
<typeMappings>
<typeMapping>OffsetDateTime=LocalDateTime</typeMapping>
</typeMappings>
<importMappings>
<importMapping>java.time.OffsetDateTime=java.time.LocalDateTime</importMapping>
</importMappings>
<additionalProperties>
<additionalProperty>
openApiNullable=false
</additionalProperty>
</additionalProperties>
</configuration>
<executions>
<execution>
<id>generate-demo-models</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/demo.yaml</inputSpec>
<packageName>org.example.generated.demo</packageName>
<modelPackage>org.example.generated.demo.objects</modelPackage>
<apiPackage>org.example.generated.demo.api</apiPackage>
</configuration>
</execution>
</executions>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment