-
Notifications
You must be signed in to change notification settings - Fork 334
Add XML Model Deserialization Support #9545
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
base: main
Are you sure you want to change the base?
Add XML Model Deserialization Support #9545
Conversation
|
No changes needing a change description found. |
cd12053 to
67c4ab3
Compare
commit: |
|
You can try these changes here
|
a4f2fa6 to
22a3f76
Compare
22a3f76 to
557b5ad
Compare
| => element.Property(nameof(XElement.Value)).As<string>(); | ||
|
|
||
| public static ScopedApi<IEnumerable<XAttribute>> Attributes(this ScopedApi<XElement> element) | ||
| => element.Invoke(nameof(XElement.Attributes)).As<IEnumerable<XAttribute>>(); |
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.
nit: new line
| { | ||
| public partial class MockInputModel : global::Sample.Models.MockInputModelBase, global::System.ClientModel.Primitives.IJsonModel<global::Sample.Models.MockInputModel> | ||
| { | ||
| protected override global::Sample.Models.MockInputModelBase PersistableModelCreateCore(global::System.BinaryData data, global::System.ClientModel.Primitives.ModelReaderWriterOptions options) |
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.
Hmm is there a reason the ordering changed?
| } | ||
|
|
||
| @route("/plants") | ||
| interface PlantOperations { |
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.
Can we have at least one model that is used as both JSON and XML?
| public bool IsHttpMetadata { get; } | ||
| public bool IsApiVersion { get; } | ||
| internal FormattableString? Description { get; } | ||
| public XmlWireInformation? XmlWireInformation { get; } |
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.
It feels a little odd to have an XmlWireInformation property in MTG when we don't even have one for JSON here. Would it be reasonable to just store off the SerializationOptions so it is a bit more generic?
| { | ||
| public class XmlWireInformation | ||
| { | ||
| public XmlWireInformation(InputXmlSerializationOptions xmlOptions) |
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.
I wonder if we can collapse this into MRWTypeDefinition.Xml
| { | ||
| public class XmlWireNamespaceOptions | ||
| { | ||
| public XmlWireNamespaceOptions(InputXmlNamespaceOptions options) |
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.
Is the XmlNamespaceOptions emitted already by the emitter? I think it would be nice if we could wrap this into the Xml serialization options and do away with InputXmlNamespaceOptions. I believe these options are still applied at the model property level but I may be missing something.
| optionalInt?: int32; | ||
|
|
||
| @doc("A nullable string") | ||
| nullableString: string | null; |
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.
Can we add the namespace options on a few properties?
Adds the initial XML deserialization support for models using MRW.
contributes to: Azure/azure-sdk-for-net#48062, #5656
fixes: #5646