swagger-api / swagger-api/swagger-codegen
Identify specific operations
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Hello, for latest version we are using a custom mustache template to generate code for rest controller, using Swagget-Code-gen we identify GET, POST, etc with:"isRestfulCreate","isRestfulIndex","isRestfulShow" variables.
Using the command below:
java -jar swagger-codegen-cli.jar generate -i customerManagement_v2.1.1.json -l spring -o samples/server/CustomerManager -t ../Templates/JavaSpring/ -DdateLibrary=joda
Swagger-Code-Gen mustache variables (isRestfulCreate,isRestfulIndex,isRestfulShow,etc) are not loading propertyly for this operations:
-
-Operation: GET /customers/{customerId}/creditInfo
-Variables Resolved: isRestfulShow=false,isRestfulIndex=false,isRestfulCreate=false,isRestfulUpdate=false,isRestfulDestroy=false -
-Operation: GET /accounts/{accountId}/productOrders
-Variables Resolved: isRestfulShow=false,isRestfulIndex=false,isRestfulCreate=false,isRestfulUpdate=false,isRestfulDestroy=false -
-Operation:POST /accounts/{accountId}/productOrders
-Variables Resolved: isRestfulShow=false,isRestfulIndex=false,isRestfulCreate=false,isRestfulUpdate=false,isRestfulDestroy=false -
-Operation:GET /accounts/{accountId}/productOrders/{orderId}
-Variables Resolved: isRestfulShow=false,isRestfulIndex=false,isRestfulCreate=false,isRestfulUpdate=false,isRestfulDestroy=false -
-Operation: PUT /accounts/{accountId}/productOrders/{orderId}
-Variables Resolved: isRestfulShow=false,isRestfulIndex=false,isRestfulCreate=false,isRestfulUpdate=false,isRestfulDestroy=false -
-Operation: GET /accounts/{accountId}/productOrders/{orderId}/status
-Variables Resolved: isRestfulShow=false,isRestfulIndex=false,isRestfulCreate=false,isRestfulUpdate=false,isRestfulDestroy=false -
-Operation: PUT /accounts/{accountId}/productOrders/{orderId}/status
-Variables Resolved: isRestfulShow=false,isRestfulIndex=false,isRestfulCreate=false,isRestfulUpdate=false,isRestfulDestroy=false
As you can see all swagger code gen resolved all operations with false. We need to identify this suboperations of GET or PUT with new variables for aply custom templates.
Is there any way of identify this operations from swagger code gen correctly and generate our own custom code in mustache via {{>subGet}} or {{>subPut}}.
THX for this great tool!!
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
Reproduce the generation command with the customerManagement_v2.1.1.json input and the custom templates in ../Templates/JavaSpring/. Inspect how the Java Spring generator exposes operation variables to Mustache, focusing on the listed nested GET and PUT paths. Done means the relevant suboperations receive usable template variables and the generated custom code distinguishes them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, spring
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100