Azure / Azure/typespec-azure

[TCGC] support an option to "keepAll" models

Open
#3,180 3 comments 0 reactions 0 assignees View on GitHub
lib:tcgc
Dominant language
TypeScript
Stars
27
Forks
90
Avg merge
1d 22h
Merged PRs (30d)
156

Description

Currently .Net generator has an option controlling what we should do for those unreferenced types. One of the options is `keepAll` which allows the user to get all the models they defined in their spec.
But those unreferenced types would not have usage, therefore currently TCGC will remove them.
Despite users could use `@@usage` to explicitly claim they want to keep this, but this is very hard to use when they have a lot of models. This happens in openai spec.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how TCGC removes unreferenced types and how the .Net generator handles the `keepAll` option. Check the existing generator tests for coverage of unreferenced models. Done means `keepAll` preserves every model defined in the spec without requiring individual `@@usage` declarations, with regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
54/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.