-
Notifications
You must be signed in to change notification settings - Fork 327
Update http-client-csharp generation to write ModelReaderWriterBuildableAttributes for all IPersistableModels #7908
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
Conversation
…Attribute generation Co-authored-by: m-nash <64171366+m-nash@users.noreply.github.com>
…tion Co-authored-by: m-nash <64171366+m-nash@users.noreply.github.com>
|
@copilot there are conflicts in the branch from main you need to sync and resolve those. |
...Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelReaderWriterContextDefinition.cs
Show resolved
Hide resolved
Co-authored-by: m-nash <64171366+m-nash@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: m-nash <64171366+m-nash@users.noreply.github.com>
Fixed merge conflicts and synced with main. The branch now includes the latest changes from main and the System.ClientModel 1.5.1 package version is maintained. All conflicts have been resolved in commit 8cb6c8a. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
docs/samples/client/csharp/plugins/logging/Logging.Plugin/src/global.json
Show resolved
Hide resolved
docs/samples/client/csharp/SampleService/SampleClient/src/Generated/SampleTypeSpecClient.cs
Show resolved
Hide resolved
...p/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Models/SampleTypeSpecContext.cs
Show resolved
Hide resolved
…textDefinition tests Co-authored-by: m-nash <64171366+m-nash@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot this test is failing https://dev.azure.com/azure-sdk/public/_build/results?buildId=5091777&view=logs&j=ed251b61-5f89-5e2e-e553-4308b1094c74&t=3be794ed-f976-5e6a-a6f6-7dac6e90dcfe&l=1848 I think it is because when you add the ModelReaderWriterBuildableAttributes to the Context class you also need to potentially add the usings for the types in typeof |
m-nash
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pause merging this we might need one more thing written into the file.
I understand the issue now. The test failure is because when we generate Looking at the Let me analyze the test failure and implement a fix to ensure proper using statement generation for all types referenced in the
Understood - pausing for your guidance on what additional changes need to be made to the generated file. |
Co-authored-by: m-nash <64171366+m-nash@users.noreply.github.com>
...ttp-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Expressions/TypeOfExpression.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
This PR implements the generation of
ModelReaderWriterBuildableAttributefor all IPersistableModels and their properties as required by the Azure SDK for .NET changes.Changes Made
Updated System.ClientModel package version from 1.4.2 to 1.5.1 to access the new
ModelReaderWriterBuildableAttributeEnhanced ModelReaderWriterContextDefinition to automatically generate
ModelReaderWriterBuildableAttributeattributes for:IPersistableModelIPersistableModeltypesHashSet<CSharpType>Follows Azure SDK pattern by adding attributes to the
ModelReaderWriterContextclass rather than individual model typesImplementation Details
The implementation adds attributes to the generated context class like this:
This matches the pattern used in the Azure SDK for .NET after PR #51067.
Testing
The generator now automatically adds one attribute for each model that implements
IPersistableModeland recursively includes all properties that are alsoIPersistableModeltypes, without duplicates.Fixes #7893.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
telemetry.astro.buildIf you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.