OpenAPITools / OpenAPITools/openapi-generator

[REQ] [Dart] Avoid using part and create mini libraries instead

Open
#3,828 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

I had to refactor the templates from using part to creating mini libraries because having models as parts caused problems. That was for my case but more generally, I think it might be a better and is the recommended approach.

Describe the solution you'd like

Refactor the templates to avoid using part

Describe alternatives you've considered

I think there are arguments to be made both ways. The official line is to avoid using part and create mini libraries instead

Using part does makes life easier in creating/editing generators as a set of part files are like one big file, but that does lose the potential benefits of having 'library private' access between files and can mean less control over what is ultimately exposed.

Also, using part for models and apis also can limit having an extra step with dart codegen that uses part (although that may be less of a concern for most people)

Additional context

https://dart.dev/guides/libraries/create-library-packages
https://stackoverflow.com/a/27764138/1992736

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 identifies Dart templates that use part as the scope; start by locating those templates and reviewing the linked Dart library-organization guidance. Confirm how the templates should be split into mini libraries, then verify the generated Dart output no longer depends on part.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.