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

additional_properties is not generated in TCGC #2788

Open
xiangyan99 opened this issue Aug 14, 2024 · 6 comments
Open

additional_properties is not generated in TCGC #2788

xiangyan99 opened this issue Aug 14, 2024 · 6 comments
Assignees

Comments

@xiangyan99
Copy link
Member

We utilize the additionalProperties feature in our search service to store various properties, as seen in this example: https://github.com/Azure/azure-rest-api-specs/edit/main/specification/search/data-plane/Azure.Search/stable/2024-07-01/searchindex.json#L1268.

These additional properties do not have a fixed schema, meaning they can include a variety of fields such as:
"hotelId": "1000"
"rating": 5
"rooms": []
"hotelName": "Azure Inn"

Without the auto-generated additional_properties field, users would have to manually enumerate all the keys within the IndexAction object to retrieve the full set of information.

It will be helpful for the users to have the additional_properties field generated.

@pshao25
Copy link
Member

pshao25 commented Aug 20, 2024

@xiangyan99 Could you elaborate your scenario with your actual behavior and expected behavior? Are you generating TypeSpec from swagger?

BTW, the additionalProperties should be written in this way with a type. https://swagger.io/docs/specification/data-models/dictionaries/

@xiangyan99
Copy link
Member Author

Yes. We are migrating swagger to TypeSpec. Today we already GAed several SDKs with addition_properties field. User can get that information using IndexAction.additional_properties.

As I showed in the description, additionalProperties is a dict and the values of the dict are not required to be string.

@pshao25
Copy link
Member

pshao25 commented Aug 21, 2024

I see. I tried locally. It successfully generates a field

...Record<unknown>;

That's how TypeSpec represents additional properties. Could you check again?

@xiangyan99
Copy link
Member Author

Yes. The TypeSpec is correct. But when I use TCGC to generate Python code from the TypeSpec, additional_properties is not generated. And my request is to generate additional_properties field in TCGC.

@pshao25 pshao25 transferred this issue from Azure/autorest Aug 22, 2024
@msyyc
Copy link
Member

msyyc commented Sep 4, 2024

Yes. The TypeSpec is correct. But when I use TCGC to generate Python code from the TypeSpec, additional_properties is not generated. And my request is to generate additional_properties field in TCGC.

I don't see the typespec link. Could you share it? @xiangyan99

@msyyc msyyc self-assigned this Sep 4, 2024
@xiangyan99
Copy link
Member Author

Yes. The TypeSpec is correct. But when I use TCGC to generate Python code from the TypeSpec, additional_properties is not generated. And my request is to generate additional_properties field in TCGC.

I don't see the typespec link. Could you share it? @xiangyan99

It can be found at https://github.com/Azure/azure-rest-api-specs/tree/search_tsp/specification/search/Azure.Search

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

3 participants