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

Typing changes for Record<unknown>[] #2827

Open
pvaneck opened this issue Sep 9, 2024 · 1 comment
Open

Typing changes for Record<unknown>[] #2827

pvaneck opened this issue Sep 9, 2024 · 1 comment

Comments

@pvaneck
Copy link
Member

pvaneck commented Sep 9, 2024

For Azure Monitor Ingestion, we have an API that takes an arbitrary list of JSON objects, and in the TypeSpec, I define it as:

body: Record<unknown>[]

I am noticing that TypeSpec is generating the Python code as:

body: Union[List[Dict[str, Any]], IO[bytes]]

where previously, with autorest, it was

JSON = MutableMapping[str, Any]
...
...
body: Union[List[JSON], IO[bytes]]

Should we maintain the JSON/MutableMapping typing for the Record<unknown>[] case? Or was this an intentional change?

@msyyc
Copy link
Member

msyyc commented Sep 10, 2024

Dict is subclass of MutableMapping and I think there is not too much difference and the change doesn't influence runtime behavior.
@iscai-msft for awareness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants