swagger-api / swagger-api/swagger-codegen

Customization Requests

Open
#2,505 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I recently created an SDK for a REST API (https://thingspace.verizon.com) and needed to do the following. Not sure how these fit with the overall goals of swagger-codegen, but I wanted to share my experience.

  1. For some requests with few fields I wanted to map the fields to parameters so the user doesn't have to create a request POJO (see example below).

  2. I needed to wrap the entire SDK anyways to try and hide minor changes from the user. One of the disadvantages of using Java for my SDK is that any change in the REST API request schema is a breaking change whereas for other types of clients (e.g. JavaScript) it would not be.

  3. I wanted to combine all of my APIs into a single class (instead of the 6 that were auto-generated by end point) to make it easier to call.

  4. I wanted to add a custom Auth token to the header of every request, but because I called apiClient.invokeAPI in 6 different places (see above) I had to add that token to each class and set it 6 times.

    public CallbackAction registerCallback(String aname, String name, String password, String url, String username) throws ApiException
    {
    RegisterCallback request = new RegisterCallback();
    request.setName(name);
    request.setPassword(password);
    request.setUrl(url);
    request.setUsername(username);
    return aCallbacksApi.registerCallbackUsingPOST(aname, request);
    }

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 generated Java SDK pattern described here, especially apiClient.invokeAPI and the six generated API classes; compare how request POJOs, combined APIs, and auth headers are currently exposed. Done would require an agreed customization design covering the four use cases, with its scope and acceptance criteria documented.

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.