swagger-api / swagger-api/swagger-codegen
How to rename the generated client SDK project by modifying the input json
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
I am using the https://editor.swagger.io/ to generate SDK. When I generate the SDK by selecting Generate Client -> CSharp, the SDK project is generated. But the problem is, I could not modify the project-name and namespaces. It by default gives the name as 'IO.Swagger.csproj' but I want to generate the SDK project name as 'MyProjectName.API'. How to achieve this?
The below is my model json file.
openapi: 3.0.1
info:
title: MyProjectName.API
version: '1'
x-packageName: MyProjectName.API
servers:
- url: http://localhost:64733
paths:
/v1/brand/ActionName:
security:
- Bearer: []
- X-API-KEY: []
Even for the Petstore example they provide the SDK project is named as 'IO.Swagger.csproj'.
I do not like to do renaming after the SDK is generated except for the case we cannot do this with https://editor.swagger.io/
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 at the editor.swagger.io Generate Client → CSharp entry point and inspect how the OpenAPI info.title and x-packageName values are passed into generation. Compare the generated IO.Swagger.csproj and namespaces with the requested MyProjectName.API names; done means those values control the generated project and namespace without manual renaming.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, openapi
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100