swagger-api / swagger-api/swagger-codegen

Using custom properties in mustache template

Open
#10,226 0 comments 0 reactions 0 assignees View on GitHub

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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.