microsoft / kiota-abstractions-dotnet

Abstractions library for the Kiota generated SDKs in dotnet
https://aka.ms/kiota/docs
MIT License
24 stars 21 forks source link

Create types for untyped nodes #177

Closed MartinM85 closed 3 months ago

MartinM85 commented 5 months ago

Closes #175

MartinM85 commented 5 months ago

I've made changes in kiota-serialization-json-dotnet, but need to reference kiota-abstractions-dotnet 1.7.6 before creating a pull request.

Suppose that at the end, the SDK generator will generate something like this

    public class WorkbookFilterCriteria : IAdditionalDataHolder, IBackedModel, IParsable {
...
        public UntypedNode? Values {
            get { return BackingStore?.Get<UntypedNode?>("values"); }
            set { BackingStore?.Set("values", value); }
        }
...
        public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers() {
            return new Dictionary<string, Action<IParseNode>> {
...
                {"values", n => { Values = n.GetUntypedValue(); } },
            };
        }
        public virtual void Serialize(ISerializationWriter writer) {
            _ = writer ?? throw new ArgumentNullException(nameof(writer));
...
            writer.WriteUntypedValue("values", Values);
            writer.WriteAdditionalData(AdditionalData);
        }
    }

instead of the current:

  public class WorkbookFilterCriteria : IAdditionalDataHolder, IBackedModel, IParsable {
...

        public Json? Values {
            get { return BackingStore?.Get<Json?>("values"); }
            set { BackingStore?.Set("values", value); }
        }
...
        public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers() {
            return new Dictionary<string, Action<IParseNode>> {
...
                {"values", n => { Values = n.GetObjectValue<Json>(Json.CreateFromDiscriminatorValue); } },
            };
        }
        public virtual void Serialize(ISerializationWriter writer) {
            _ = writer ?? throw new ArgumentNullException(nameof(writer));
...
            writer.WriteObjectValue<Json>("values", Values);
            writer.WriteAdditionalData(AdditionalData);
        }
    }
github-actions[bot] commented 5 months ago

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

github-actions[bot] commented 4 months ago

Conflicts have been resolved. A maintainer will take a look shortly.

github-actions[bot] commented 4 months ago

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

github-actions[bot] commented 4 months ago

Conflicts have been resolved. A maintainer will take a look shortly.

github-actions[bot] commented 3 months ago

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

baywet commented 3 months ago

Just as an update to anyone watching this: we're finalizing the work on the other main languages before we merge everything in. Thank you for your patience :)