Bug Report Checklist
Description
Generated method with response/return of type array is missing the array and instead only using the wrapped object. The following locations are affected:
expected:
@ApiResponse(responseCode = "200", description = "Get an array/list of objects", content = {
@Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = ReturnArrayGet200ResponseInner.class)))
})
actual:
@ApiResponse(responseCode = "200", description = "Get an array/list of objects", content = {
@Content(mediaType = "application/json", schema = @Schema(implementation = ReturnArrayGet200ResponseInner.class))
})
exampleString
expected:
String exampleString = "[{ \"property2\" : \"property2\", \"property1\" : 0 }]";
actual:
String exampleString = "{ \"property2\" : \"property2\", \"property1\" : 0 }";
additional notes
openapi-generator version
v6.0.1
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: Demo
description: Demo for Bugreport
version: 1.0.0
paths:
/return-array:
get:
responses:
'200':
description: 'Get an array/list of objects'
content:
application/json:
schema:
type: array
items:
type: object
properties:
property1:
type: integer
format: int64
property2:
type: string
maxLength: 255
Generation Details
Generated via openapi-generator-maven-plugin:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>6.0.1</version>
<executions>
<execution>
<id>generate-test</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/api/test.yml</inputSpec>
<generatorName>spring</generatorName>
<library>spring-boot</library>
<output>${project.build.directory}/generated-sources/openapi/test</output>
</configuration>
</execution>
</executions>
</plugin>
Steps to reproduce
- create a new maven project
- place the provided
test.yml into its api directory
- add the provided plugin configuration to your
pom.xml
- generate the API, e.g.:
mvn clean package
- check the generated
ReturnArrayApi.java
Suggest a fix
The Mustache files responsible for the marked locations might ignore the array type or detect it incorrectly.
Bug Report Checklist
Description
Generated method with response/return of type
arrayis missing the array and instead only using the wrapped object. The following locations are affected:@apiresponse
expected:
actual:
exampleString
expected:
actual:
additional notes
List<ReturnArrayGet200ResponseInner>openapi-generator version
v6.0.1
OpenAPI declaration file content or url
Generation Details
Generated via openapi-generator-maven-plugin:
Steps to reproduce
test.ymlinto itsapidirectorypom.xmlmvn clean packageReturnArrayApi.javaSuggest a fix
The Mustache files responsible for the marked locations might ignore the array type or detect it incorrectly.