swagger-api / swagger-api/swagger-codegen

[java] Compilation error when creating classes for operation ref $ref: #/path/~1..

Open
#11,737 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I am getting a compilation error on the code generated using maven plugin "swagger-codegen-maven-plugin" v 3.0.32 when I have operational ref pointing to something in the path.

Swagger-codegen version

3.0.32

Swagger declaration file content or url

https://gist.github.com/mokapat/9b731085bdb01fd1acdc5824594bc523

Command line used for generation

<plugin> <groupId>io.swagger.codegen.v3</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>3.0.32</version> <dependencies> <dependency> <groupId>com.github.jknack</groupId> <artifactId>handlebars</artifactId> <version>4.3.0</version> </dependency> </dependencies> <executions> <execution> <goals> <goal>generate</goal> </goals> <configuration> <inputSpec>${basedir}/path/to/json</inputSpec> <language>java</language> <library>resttemplate</library> <modelPackage>com.demo.client.model</modelPackage> <apiPackage>com.demo.client.api</apiPackage> <invokerPackage>com.demo.client.invoker</invokerPackage> <generateApiTests>false</generateApiTests> <generateApiDocumentation>false</generateApiDocumentation> <generateModelTests>false</generateModelTests> <generateModelDocumentation>false</generateModelDocumentation> <generateSupportingFiles>true</generateSupportingFiles> <output>.</output> <configOptions> <interfaceOnly>true</interfaceOnly> <dateLibrary>17</dateLibrary> <source>17</source> <target>17</target> </configOptions> </configuration> </execution> </executions> </plugin>

Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

image

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 with the Swagger declaration in the linked gist and the provided swagger-codegen-maven-plugin configuration, then reproduce generation with version 3.0.32. Inspect the generated Java output for an operation $ref targeting a path and capture the compilation error; done means the generated client compiles for this input.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.