Bug Report Checklist
Description
New version of open api generator 7.13.0 generates incorrect java file when x-spring-paginated is set to true and explicit page and size parameters are provided.
Version 7.12.0 generetes:
@Operation(
operationId = "getTasks",
summary = "Returns a list of tasks.",
tags = { "tasks" },
responses = {
@ApiResponse(responseCode = "200", description = "Successful response", content = {
@Content(mediaType = "application/json", schema = @Schema(implementation = GetTasksResponseDTO.class))
})
}
)
@RequestMapping(
method = RequestMethod.GET,
value = "/tasks",
produces = { "application/json" }
)
ResponseEntity<GetTasksResponseDTO> getTasks(
@Min(0) @Parameter(name = "page", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "page", required = false) Integer page,
@Min(10) @Max(100) @Parameter(name = "size", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "size", required = false) Integer size,
@ParameterObject final Pageable pageable
);
Version 7.13.0 generetes:
@Operation(
operationId = "getTasks",
summary = "Returns a list of tasks.",
tags = { "tasks" },
responses = {
@ApiResponse(responseCode = "200", description = "Successful response", content = {
@Content(mediaType = "application/json", schema = @Schema(implementation = GetTasksResponseDTO.class))
})
}
)
@RequestMapping(
method = RequestMethod.GET,
value = "/tasks",
produces = { "application/json" }
)
ResponseEntity<GetTasksResponseDTO> getTasks(
,
@ParameterObject final Pageable pageable
);
In version 7.13.0 there is an additional coma and parameters documentation in annotation are missing
openapi-generator version
7.13.0
OpenAPI declaration file content or url
openapi: 3.1.1
info:
title: Tasks API
description: Tasks sample API
version: 0.0.1
paths:
/tasks:
get:
summary: Returns a list of tasks.
operationId: GetTasks
tags:
- tasks
x-spring-paginated: true
parameters:
- $ref: "#/components/parameters/pageablePage"
- $ref: "#/components/parameters/pageableSize"
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/GetTasksResponse"
components:
schemas:
GetTasksResponse:
type: object
properties:
tasks:
type: array
items:
$ref: "#/components/schemas/Task"
required:
- tasks
Task:
type: object
properties:
id:
type: string
readOnly: true
summary:
type: string
required:
- id
- summary
parameters:
pageablePage:
in: query
name: page
schema:
type: integer
format: int32
minimum: 0
required: false
pageableSize:
in: query
name: size
schema:
type: integer
format: int32
minimum: 10
maximum: 100
required: false
Generation Details
I have configured maven plugin:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi-generator-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<inputSpec>${project.basedir}/tasks-openapi.yaml</inputSpec>
<generatorName>spring</generatorName>
<modelPackage>alien11689.playground.taskprovider.tasks.model</modelPackage>
<apiPackage>alien11689.playground.taskprovider.tasks.api</apiPackage>
<invokerPackage>alien11689.playground.taskprovider.tasks.invoker</invokerPackage>
<modelNameSuffix>DTO</modelNameSuffix>
<configOptions>
<interfaceOnly>true</interfaceOnly>
<skipDefaultInterface>true</skipDefaultInterface>
<useSpringBoot3>true</useSpringBoot3>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Steps to reproduce
Generate java+spring project with provided above plugin and open api file
Related issues/PRs
#21016 seems to be the cause
Suggest a fix
N/A
Bug Report Checklist
Description
New version of open api generator 7.13.0 generates incorrect java file when
x-spring-paginatedis set totrueand explicitpageandsizeparameters are provided.Version 7.12.0 generetes:
Version 7.13.0 generetes:
In version 7.13.0 there is an additional coma and parameters documentation in annotation are missing
openapi-generator version
7.13.0
OpenAPI declaration file content or url
Generation Details
I have configured maven plugin:
Steps to reproduce
Generate java+spring project with provided above plugin and open api file
Related issues/PRs
#21016 seems to be the cause
Suggest a fix
N/A