Azure / typespec-azure

About TypeSpec Azure Libraries
https://azure.github.io/typespec-azure/
MIT License
15 stars 42 forks source link

For client, visibility("none") should make the property disapear #1916

Open lmazuel opened 1 day ago

lmazuel commented 1 day ago

Confirmed with @bterlson , if it's none, make it go away entirely.

I would expect that TCGC does that in a central place, in a way that emitter do not even know it ever existed.

https://github.com/bterlson/typespec-todo/blob/271e2d528ed60e62fbd1c24ed977ed0bc8952fba/main.tsp#L39-L40

  /** Whether the user is validated. Never visible to the API. */
  @visibility("none") validated: boolean;
lmazuel commented 1 day ago

I was thinking how to write a cadl-ranch test for that, I guess we could go:

 @visibility("none") do_not_send: "literal value";

I believe today if you put a constant like that, we always send it. If it's visibility none, it shouldn't be in the generated model, and the mockapi could test that it never received it.

tadelesh commented 1 day ago

added support for typespec 0.62. but next version, typespec will have a big change for visibility: https://github.com/microsoft/typespec/pull/4825. after it release, tcgc need to do a adoption change.

tadelesh commented 1 day ago

test case: https://github.com/microsoft/typespec/pull/5210