swagger-api / swagger-api/swagger-codegen

[JAVA] Generate code without library/dependencies

Open
#11,108 2 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 coming from JAXWS background where I can point xjc (or related maven plugins) at wsdl file and generate the necessary interfaces without dependency on a particular client and deserializers. How can I achieve the same thing with swagger codegen tool?

In addition, when generating code with maven plugin, the tool writes additional src/main/java directories under target/generated-sources/swagger/ even with support files disabled. How do I prevent that?

Swagger-codegen version

3.0.27 maven-plugin

Swagger declaration file content or url

No.

Command line used for generation
              <configuration>
                <inputSpec>${project.basedir}/src/main/resources/document-service.json</inputSpec>
                <language>java</language>
                <generateSupportingFiles>false</generateSupportingFiles>
                <generateApis>false</generateApis>
                <generateModels>true</generateModels>
                <generateApiDocumentation>false</generateApiDocumentation>
                <generateModelDocumentation>false</generateModelDocumentation>
                <verbose>true</verbose>
                <modelPackage>se..document.model</modelPackage>
              </configuration>
Steps to reproduce

Take any openapi spec and generate it with java language

Related issues/PRs
Suggest a fix/enhancement

It would be better if I could generate just the interface for functions provided by endpoints and implement it myself using my own client and models without using some sort of deserializer.

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 examining the Java generator and Maven plugin handling for generateSupportingFiles, generateApis, and generateModels. Determine whether the requested interface-only generation and avoidance of extra src/main/java directories can be specified independently, then verify the behavior with an OpenAPI spec and the provided Maven configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.