-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
Using the spring-cloud library of the spring generator results in a ClientConfiguration.java file generated and referenced by a Feign-Client API interface that lists unnecessary packages. Without specifying these packages as "compile-time" dependencies the service cannot be compiled. Making the package import definitions conditional this is mitigated.
openapi-generator version
4.2.2. No regression.
OpenAPI declaration file content or url
openapi: "3.0.0"
info:
version: 0.1.0
title: frontend-v1
license:
name: MIT
paths:
/echo:
post:
summary: Echoes back your own words.
requestBody:
description: The sound to echo.
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/EchoRequest"
responses:
"200":
description: Your echo as requested.
content:
application/json:
schema:
$ref: "#/components/schemas/EchoResponse"
components:
schemas:
EchoRequest:
properties:
sound:
type: string
description: The sound to echo.
required:
- sound
EchoResponse:
properties:
echo:
type: string
description: The actual echo.
required:
- echoCommand line used for generation
java -jar openapi-generator-cli.jar generate -i spec.yaml -g spring --library spring-cloud
Steps to reproduce
- Get the spec
- Run the command line
- Try to compile the generated code with minimal dependencies.
Related issues/PRs
The same seemed to happen in typescript-rxjs generator
#3339
Suggest a fix
Import packages conditionally.
Reactions are currently unavailable