OpenAPITools / OpenAPITools/openapi-generator

[REQ] [Dart] Config option to generate endpoint methods with named parameters for all parameters

Open
#16,969 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.

We're relying on a YAML file created by another team to generate our APIs and models, but this team sometimes has trouble keeping it consistent for unexplained technical reasons. Recently two request parameters of same type got swapped for an endpoint, and so did the (positional) parameters of the corresponding endpoint method after updating the API package. The evident problems that ensued got unnoticed until late

Describe the solution you'd like

This problem could definitely have been avoided if the endpoint method parameters were named, since the order parameters are provided doesn't matter in that case
This would manifest as a config option named (for instance) useNamedParameters

This doesn't seem too fancy a feature to me since the Dart philosophy (especially with Flutter) is to declare methods this way

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 by tracing the Dart generator's endpoint-method entry point and its existing configuration handling. Check how generated methods currently receive parameters and how YAML options are passed through. Done means a configuration option such as useNamedParameters consistently produces Dart endpoint methods whose parameters can be supplied by name.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
api, 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.