OpenAPITools / OpenAPITools/openapi-generator

Refactor org.openapitools.codegen package

Open
#12,200 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Hi, @wing328 @spacether

Issue Description

Package org.openapitools.codegen is a promiscuous package, and groups together miscellaneous functionalities that might be useful to different subsystems. The package structure violates the “high cohesion and low coupling” design rules. I found that Class CliOption and SpecValidationException is not used by classes in their package. The project has grown larger, leading to becoming increasingly hard to maintain. For example, if one modifies package org.openapitools.codegen (i.e., package rename), resulting in multiple classes of package org.openapitools.codegen.languages to be changed.

Location: The source file can be found at path File modules/openapi-generator/src/main/java/org/openapitools/codegen/CliOption.java
modules/openapi-generator/src/main/java/org/openapitools/codegen/SpecValidationException.java

Refactoring suggestions

I suggest to move class CliOption into package org.openapitools.codegen.languages, SpecValidationException into package org.openapitools.codegen.config.

openapigenerator-CliOption-java openapigenerator-SpecValidationException-java

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 modules/openapi-generator/src/main/java/org/openapitools/codegen/CliOption.java and SpecValidationException.java, then inspect references to both classes across the generator. Done means CliOption is in org.openapitools.codegen.languages, SpecValidationException is in org.openapitools.codegen.config, and affected references compile with the new package locations.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.