swagger-api / swagger-api/swagger-codegen

how to Generate Builder Pattern in swagger-codegen-maven-plugin

Open
#9,595 0 comments 14 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

Hello for the best and kind community ever!
It is possible to generate builder pattern in swagger codegen?
Here is my config:

            <plugin>
                <groupId>io.swagger</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>2.4.7</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.basedir}/src/main/resources/bfam-swagger-ui.yaml</inputSpec>
                            <language>java</language>
                            <output>${project.build.directory}/generated-sources</output>
                            <library>feign</library>

                            <modelPackage>com.negixn.bssbox.uniblp.adapter.model</modelPackage>
                            <apiPackage>com.negixn.bssbox.uniblp.adapter.api</apiPackage>
                            <invokerPackage>com.negixn.bssbox.uniblp.adapter</invokerPackage>

                            <generateModels>true</generateModels>
                            <generateApis>false</generateApis>
                            <generateSupportingFiles>false</generateSupportingFiles>

                            <ignoreFileOverride>${project.basedir}/.swagger-codegen-ignore</ignoreFileOverride>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

I've tried use newest swagger version which is 3.0.0-rc1
There is no tips (like "%buider%") in tag configuration
Can anyone advise a a way to generate buider for DTObjects

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 Maven plugin configuration shown, especially language=java and generateModels=true, then inspect the Java model-generation entry point for builder support. Done means establishing whether swagger-codegen 2.4.7 or 3.0.0-rc1 supports builder generation and recording the supported configuration or limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend-api-design
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.