swagger-api / swagger-api/swagger-codegen
Using custom properties in mustache template
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I need to be able to use properties defined in .json file in while generating the client for swift4
Swagger-codegen version
3.0.19
Command line used for generation
swagger-codegen generate -i api.json -l swift4 -c config.json -t MustacheFiles
Steps to reproduce
In my api.json file I added a field like this -> { "myVar" : "SomeText" }
And in api.mustache file for swift4 I'm trying to use that variable by calling {{myVar}}, I have tried to use several different options but couldn't manage to reach that variable while generating.
Is there a way or a special command for defining custom variables to be used in these templates while using swagger-codegen?
I really need help in this. Please suggest me a solution
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 documented generation command using api.json, config.json, the swift4 generator, and the custom MustacheFiles template directory. Determine whether properties added to api.json are exposed to api.mustache during generation, and verify the result by generating the Swift client and checking whether the custom value appears in the output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100