Update serialization code to use new signatures#3838
Merged
ArcturusZhang merged 47 commits intoAzure:feature/v3from Jan 4, 2024
Merged
Update serialization code to use new signatures#3838ArcturusZhang merged 47 commits intoAzure:feature/v3from
ArcturusZhang merged 47 commits intoAzure:feature/v3from
Conversation
f6e27f9 to
f3204c3
Compare
ArcturusZhang
commented
Oct 16, 2023
a6ee114 to
cf5d515
Compare
ArcturusZhang
commented
Oct 20, 2023
src/AutoRest.CSharp/Common/Output/Expressions/KnownValueExpressions/XAttributeExpression.cs
Show resolved
Hide resolved
ArcturusZhang
commented
Oct 20, 2023
ArcturusZhang
commented
Oct 20, 2023
src/AutoRest.CSharp/Common/Output/Models/Serialization/PropertySerialization.cs
Outdated
Show resolved
Hide resolved
ArcturusZhang
commented
Oct 20, 2023
ArcturusZhang
commented
Nov 7, 2023
ArcturusZhang
commented
Nov 7, 2023
src/AutoRest.CSharp/Common/AutoRest/Plugins/NewProjectScaffolding.cs
Outdated
Show resolved
Hide resolved
ArcturusZhang
commented
Nov 7, 2023
src/AutoRest.CSharp/Common/Generation/Writers/CodeWriterExtensions.Methods.cs
Show resolved
Hide resolved
pshao25
reviewed
Nov 7, 2023
chunyu3
reviewed
Nov 9, 2023
src/AutoRest.CSharp/Common/Generation/Writers/PageableMethodsWriterExtensions.cs
Outdated
Show resolved
Hide resolved
Member
|
LGTM, just a simple comment. I approved it. |
chunyu3
approved these changes
Nov 9, 2023
live1206
reviewed
Nov 9, 2023
...t.CSharp/Common/Output/Expressions/KnownValueExpressions/SerializableObjectTypeExpression.cs
Outdated
Show resolved
Hide resolved
src/AutoRest.CSharp/Common/Output/Models/Serialization/PropertySerialization.cs
Show resolved
Hide resolved
src/AutoRest.CSharp/Common/Output/Models/Types/SerializableObjectType.cs
Outdated
Show resolved
Hide resolved
This was referenced Nov 14, 2023
live1206
reviewed
Dec 21, 2023
src/AutoRest.CSharp/Common/Output/Builders/JsonSerializationMethodsBuilder.cs
Show resolved
Hide resolved
live1206
approved these changes
Dec 21, 2023
live1206
approved these changes
Dec 21, 2023
… this is working well
live1206
approved these changes
Dec 27, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #3434
Fixes #3181
Fixes #3353
Fixes #2351
Fixes Azure/azure-sdk-for-net#16977
Fixes #2833
Description
This feature literally changes every model, therefore this PR will have a lot of files changed. Details of features included in this PR are listed below.
In summary, now a model's serialization class will look like this:
For serialization partial class
IJsonModel<T>where T is itselfIJsonModel<object>as well, otherwise compilation will failIJsonModel<BaseType>IJsonModel<T>interface.IJsonModel<T>, andIUtf8JsonSerializablejust calls the implementationDeserializeXXXmethod remains mostly unchanged, a new optional parameterModelReaderWriterOptions optionsis added.[DeserializationProxy(typeof(<the unknown internal type of it>))]options.Format == ModelReaderWriterFormat.Jsonoptions.Format == ModelReaderWriterFormat.Json.(question) should we change this to
options.Format != ModelReaderWriterFormat.Wire?options.Format == ModelReaderWriterFormat.JsonIUtf8JsonSerializable(this might change in the future)We leave the
ToRequestContentmethod andFromResponsemethod unchanged, until the corresponding APIs in Azure.Core get into its next stable release.For the model itself
_serializedAdditionalRawDatachange does not happen on the models that already have additional properties.Since
_serializedAdditionalRawDatais just a private/protected internal version of AdditionalProperties, we will reuse theAdditionalPropertiesfunctionalities to implement it.Checklist
To ensure a quick review and merge, please ensure:
Ready to Land?