swagger-api / swagger-api/swagger-codegen

Custom code generator, custom classes/interfaces names and new folders/files

Open
#6,608 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

Hi, I developed a custom code generator following the guidelines shared on the wiki. I managed to
define one that extends AbstractJavaJAXRSServerCodegen abstract class. I didn't figure out how to:

  • define new folders and files inside them, in a programatic way (since I'm developing on an OSGi runtime, I was wondering if I could generate dynamically a ${component}.xml for each yaml file and ). I managed to create an OSGI-INF folder with writeOptional... method. Now I need to put as many .xml files as yaml files inside this folder.
  • define my own policy for classes and interfaces names. My urgent need is to prefix interfaces with a I character to be compliant with code styling guidelines

Is it possibile ? I suppose I should work on my generator java class but I can't find any hint to do it. Also I didn't find exact references inside parent classes of my generator

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 generator Java class and its AbstractJavaJAXRSServerCodegen parent, then review the wiki guidance it follows. Trace the existing writeOptional... use for OSGI-INF and identify how generated paths and names are selected. Done means the generator can create one ${component}.xml per YAML file and apply the requested I-prefixed interface naming policy.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
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.