swagger-api / swagger-api/swagger-codegen

Custom template to add annotation for spring data

Open
#5,799 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

General: Question
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

In model class generated I want some annotation to be generated for it to persist in db using spring data. Used template but I can only put static code if want to introduce some dynamic param like {{#myanotation}} then can specify from properties or .yml file it would be great

java -jar swagger-codegen-cli-2.2.1.jar generate -i api.yml -c conf.json -l spring -o %TMP_SRC_DIR% -t C:\Users\template

api.yml --> yaml for apis as we as models
%TMP_SRC_DIR% --> output directory any
template folder had model.mustache and api.mustache which I want to modify

Scenario want to generate required set of files as dont want to change model classes manually

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 custom model.mustache and api.mustache templates referenced in the issue, then inspect how conf.json and the spring generator process template values during the swagger-codegen-cli generate command. The requested behavior is dynamic annotation content for generated model classes, supplied through configuration or a YAML file; done means the generated models contain the requested annotations without manual edits.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.