requestMapping for basepath defined in swagger '2.0' is missing in generation with io.swagger.codegen.v3
Shiva2199 opened this issue · 2 comments
I am using swagger-codegen-maven-plugin to generate my resttemplate classes. I am currently upgrading my Application to spring boot 3 and I see swagger-codegen-maven-plugin with groupID io.swagger and language Spring doesnt have support for Jakarta and the alternative is to move to the swagger-codegen-maven-plugin io.swagger.codegen.v3 which supports both swagger 2 and jakarta based imports.But In the process I see the basePath provided in swagger definition is being ignored.
Can this be solved by changing some config params ? is there any other way to do this?
Please find below config:
`swagger: '2.0'
info:
description: ''
version: '2.0'
title: new 10.3
host: localhost
basePath: /app/api/v1
tags:
- name: app
description: >-
API for getting information.
schemes: - https
produces: - application/json
paths:
/state:
get:
tags:
- Sate
summary: Get state
description: Return state.
operationId: getState
responses:
'200':
description: OK
schema:
$ref: '#/definitions/State'`
Plugin Config:
old plugin
<plugin> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>2.4.12</version> <executions> <execution> <id>generate-state</id> <goals> <goal>generate</goal> </goals> <phase>generate-sources</phase> <configuration> <language>spring</language> <inputSpec>${project.build.directory}/state.yaml</inputSpec> <output>${codegen.rest.dir}</output> <apiPackage>endpoint.rest.api.interfaces</apiPackage> <modelPackage>endpoint.rest.api.model</modelPackage> <addCompileSourceRoot>false</addCompileSourceRoot> <generateApiDocumentation>false</generateApiDocumentation> <generateApiTests>false</generateApiTests> <generateModelTests>false</generateModelTests> <generateModelDocumentation>false</generateModelDocumentation> <generateSupportingFiles>false</generateSupportingFiles> <configOptions> <sourceFolder>.</sourceFolder> <delegatePattern>true</delegatePattern> <java8>true</java8> <jakarta>true</jakarta> <!-- has no impact --> </configOptions> </configuration> </execution> </executions> </plugin>
V3- Plugin
`<plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.47</version>
<executions>
<execution>
<id>generate-state</id>
<goals>
<goal>generate</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<language>spring</language>
<inputSpec>${project.build.directory}/state.yaml</inputSpec>
<output>${codegen.rest.dir}</output>
<apiPackage>endpoint.rest.api.interfaces</apiPackage>
<modelPackage>endpoint.rest.api.model</modelPackage>
<addCompileSourceRoot>false</addCompileSourceRoot>
<generateApiDocumentation>false</generateApiDocumentation>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<generateModelDocumentation>false</generateModelDocumentation>
<generateSupportingFiles>false</generateSupportingFiles>
<configOptions>
<jakarta>true</jakarta>
<sourceFolder>.</sourceFolder>
<delegatePattern>true</delegatePattern>
<java8>true</java8>
</configOptions>
</configuration>
</execution>
<execution>`
@HugoMario / @tgillain Can you please suggest ?
Hi @Shiva2199 ,
From our side we migrated our project to use openapi-generator-maven-plugin since its more frequent release policy was fitting better our needs. So unfortunately I cannot help.