swagger-api / swagger-api/swagger-codegen

[Elixir] Add the ability to configure base URL when using client

Open
#8,720 0 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

We're using swagger codegen to generate clients for our API project, one of which is an Elixir client. We run multiple versions of our API in different environments (production, staging, sandbox, etc.) and we'd like to use the same generated client to be able to access all of these APIs.

In our circumstances the only difference between the environments is in the URL. We would like to use the same client to access these environments, but be able to additionally configure and override the base URL that the clients were built with.

Suggest a fix/enhancement

The ability to configure this has come up before with other users. GCP made changes to their templates (https://github.com/GoogleCloudPlatform/elixir-google-api/pull/81/files) to accept a base URL as a config but default to basePath if not found.

I'd like to propose something similar and I'm willing to put up a PR for it.

This doesn't need to be a default behavior - if there is an appropriate build flag that this behavior can be gated on I'm open to suggestions!

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 Elixir client generation templates and compare the proposed behavior with the linked elixir-google-api pull request. Done means the generated client can accept an overridable base URL for different environments while retaining basePath as the default.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
api
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.