swagger-api / swagger-api/swagger-codegen

[JAVA] Codegen for multi server

Open
#8,944 3 comments 1 reaction 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 want to generate a client for a yaml that handle different server urls depending on where I want to test. My client only gets the first url from the yaml. Is there a way to say what url is used for this client. Maybe to insert in the bash call?

Swagger-codegen version

swagger-codegen-cli-3.0.3-20181125.212437-36.jar

Swagger declaration file content or url
servers:
  - url: 'https://...'
    description: Staging system
  - url: 'https://...'
    description: Dev system
Command line used for generation

java -jar swagger-codegen-cli-3.jar generate -i api.yaml -l java -o api-client --group-id de.api --artifact-id api-client --git-repo-id api

Steps to reproduce

Add second server url and generate code

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 reproducing the Java client generation command with the provided OpenAPI YAML containing staging and development servers, then trace where the generator handles the servers list. Determine how a generated client should select a server, including whether that choice can be passed through the command line. Done means the generated client supports the requested server selection instead of always using the first URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.