OpenAPITools / OpenAPITools/openapi-generator

[Java][WebClient] Missing Spring dependency in build.gradle

Open Beginner friendly
#6,739 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

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)

[Java][WebClient]
Bug

Description

Missing dependency org.springframework in build.gradle using Java with library webclient

Swagger-codegen version

Master (5.0.0)

Swagger declaration file content or url

After generating code with java and library webclient. gradle.build file is missing a dependency (org.springframework) which makes building the project with gradle not possible. Note that building it with Maven works fine

Command line used for generation

I am using the following command

java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java --library webclient -o /tmp/javaWebclient
Steps to reproduce

Using the command above and building project with gradle leads to import errors e.g.
error: package org.springframework.core does not exist import org.springframework.core.ParameterizedTypeReference;

Related issues/PRs
Suggest a fix/enhancement

Adding the following dependency to build.gradle.mustache (in dependencies java webclient)

compile "org.springframework:spring-webflux:$spring_web_version"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided OpenAPI Generator command with the Java WebClient library, then build the generated project with Gradle to reproduce the missing import errors. Inspect build.gradle.mustache and compare its WebClient dependencies with the Maven output; done means the generated Gradle project builds with the required Spring dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, spring
Domain
api, build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.