OpenAPITools / OpenAPITools/openapi-generator

[REQ] [Dart] Models as value types

Open
#3,797 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 would like to be able to have the generator produce models that are value types with features like immutability, state based equivalence and deep clone / copyWith.

Describe the solution you'd like

built_value

Describe alternatives you've considered

The openapitools generator could just add an overload of == and hashMap and a copyWith function to each model, but there are other benefits of built_value and (imo) it is a better option. It does require an extra code gen step though, and has the weird dart source_gen syntax so I'm sure it's not everyone's cup of tea.

Additional context

I don't know if this is something others would want but I plan to implement this for myself so I thought I would create an issue for discussion.

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 request names no files, tests, or Dart generator entry points. First confirm the desired built_value integration and acceptance criteria with maintainers; done would mean the agreed value-type behavior is supported by the Dart generator and verified by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.