swagger-api / swagger-api/swagger-codegen
Customization Requests
Nobody has claimed this yet.
- 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.
-
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).
-
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.
-
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.
-
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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