[BUG][openapi-generator-maven-plugin] importmapping not respected since 5.4.0
See original GitHub issueBug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue? Yes, inside attached ZIP
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists? -> No, but tested with 5.4.0
- Have you searched for related issues/PRs?
- What’s the actual output vs expected output? Expected: StreamingResponseBody, Actual: Stream
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
The “importMappings” seem to have no effect with version 5.4.0. With version 5.3.1 the below configuration resulted in a “StreamingResponseBody” in the generated class. With version 5.4.0 a “Stream” class is imported but that one does not exist.
openapi-generator version
Issue occurs with openapi-generator-maven-plugin 5.4.0 and did not occur with the previous version 5.3.1.
OpenAPI declaration file content or url
If you post the code inline, please wrap it with
openapi: 3.0.3
info:
title: Demo app
version: 1.0.0
servers:
- url: /api/v1
paths:
/demo:
get:
summary: Demo
operationId: demo
responses:
'200':
description: Demo response
content:
text/csv:
schema:
type: string
format: binary
Generation Details
Plugin configuration:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- With version 5.3.1 of the plugin, the generated "DemoApi.java" contains default org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody as expected -->
<!-- With version 5.4.0 of the plugin, the generated "DemoApi.java" contains "Stream", but the org.example.bug.demo.api.Stream is not created -->
<version>5.4.0</version>
<executions>
<execution>
<id>bug-demo</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/spec.yaml</inputSpec>
<generatorName>spring</generatorName>
<apiPackage>org.example.bug.demo.api</apiPackage>
<modelPackage>org.example.bug.demo.api</modelPackage>
<configOptions>
<delegatePattern>true</delegatePattern>
</configOptions>
<importMappings>
stream=org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody
</importMappings>
<typeMappings>string+binary=stream</typeMappings>
</configuration>
</execution>
</executions>
</plugin>
Steps to reproduce
Run mvn clean install
on the attached demo project.
Related issues/PRs
No similar issues.
Suggest a fix
Not sure what causes the problems, but I assume it has to do with this change: https://github.com/OpenAPITools/openapi-generator/pull/11217
bug Demo application
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:26 (11 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same, but for the gradle plugin
Same here