Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discuss how TypeSpec unknown is generated in DPG #2078

Closed
Tracked by #2419
joheredi opened this issue Oct 22, 2023 · 3 comments · Fixed by #2546
Closed
Tracked by #2419

Discuss how TypeSpec unknown is generated in DPG #2078

joheredi opened this issue Oct 22, 2023 · 3 comments · Fixed by #2546
Assignees
Labels
HRLC p0 priority 0

Comments

@joheredi
Copy link
Member

joheredi commented Oct 22, 2023

Here are the options:

  • Literal translation - Gets generated as unknown
  • Follow the openapi emitter - Generate a any object Record<string, unknown> or Record<string, any> (link)
  • Generate as any
@qiaozha
Copy link
Member

qiaozha commented Oct 24, 2023

In the context that we don't split input model and output model, I prefer to generate as any. Because unknown will require customer to guard each access check and any doesn't need this.
Just one point to note here, any -> unknown is a breaking while unknown -> any is not.

@MaryGao
Copy link
Contributor

MaryGao commented Oct 25, 2023

Follow the openapi emitter - Generate a any object Record<string, unknown> or Record<string, any>

Not sure I got the point here but I think for openapi the unknown is not a any object but any type see Tim's comment here.

@qiaozha
Copy link
Member

qiaozha commented May 21, 2024

I think we have decided to treat unknown as any? #2469 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HRLC p0 priority 0
Projects
Development

Successfully merging a pull request may close this issue.

4 participants