swagger-api / swagger-api/swagger-codegen

[swagger Model ] How to categorise models

Open
#6,926 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This is more of a question.

I have around 20 model definitions in swagger.yaml and when i generate code its quite messy with all the models being in same directory. Is there a way to categorize them ?

Say i have models definitions for cats, chairs, dogs, tables, books, pens . How do i generate code that categorises into sub packages like below

models.animals
  cats, dogs
models.furniture
 tables,chairs
models.stationary
 books, pens 

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

The issue names swagger.yaml and generated model output but no implementation files or tests. Start by checking how the generator maps model definitions to packages, then determine whether grouping models into subpackages is supported for the relevant target language. Done should mean a defined way to generate categories such as animals, furniture, and stationery.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
devtools
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.