TypeScript: Add generator-flag so that fields specified as required are generated as required
- Dominant language
- C#
- Stars
- 3.8k
- Forks
- 333
- Avg merge
- 16h 29m
- Merged PRs (30d)
- 116
Description
My concern is essentially the same as issue #3244
- I want to use kiota to generate typescript
- I have explicitly marked most of the fields in my models as required in the spec
- but kiota is still generating them as optional
#3244 was closed with the reasoning, that many APIs support field-selection or partial updates and thus need the models to be more flexible. And while I can certainly see that use case, that decision is rather suboptimal for all other APIs that do not use those features.
To support both scenarios could we perhaps introduce some kind of generator flag to toggle the behavior? Like `--strict-nullability` or `--strict-requiredness` or `--allow-partial-models` or `--model-required-fields strict|optional`.
Contributor guide
Research direction
The issue names no files or tests; start by reviewing issue #3244 and tracing the TypeScript generation path for required fields. Define how the proposed generator flag should interact with the current default behavior, then verify that required fields in the specification can be generated as required without breaking the existing flexible-model mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100