diff --git a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json index 9d80aba967..5cbace7811 100644 --- a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json +++ b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json @@ -4839,7 +4839,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInErrorDocument" + "$ref": "#/components/schemas/errorTopLevelLinks" } ] }, @@ -4877,143 +4877,10 @@ }, "additionalProperties": false }, - "linksInErrorDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInRelationship": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceCollectionDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceData": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierCollectionDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierDocument": { - "required": [ - "related", - "self" - ], + "errorTopLevelLinks": { "type": "object", "properties": { "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, "type": "string" }, "describedby": { @@ -5032,7 +4899,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -5064,7 +4931,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -5110,15 +4977,12 @@ "additionalProperties": false }, "nullableToOnePersonInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -5196,7 +5060,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -5304,7 +5168,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -5348,7 +5212,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -5411,7 +5275,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -5515,7 +5379,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -5542,6 +5406,105 @@ }, "additionalProperties": false }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "tagAttributesInPatchRequest": { "type": "object", "properties": { @@ -5585,7 +5548,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -5693,7 +5656,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -5737,7 +5700,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierCollectionDocument" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, @@ -5799,7 +5762,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -5888,15 +5851,12 @@ "additionalProperties": false }, "toManyTagInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -5932,15 +5892,12 @@ "additionalProperties": false }, "toManyTodoItemInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -5977,15 +5934,12 @@ "additionalProperties": false }, "toOnePersonInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -6092,7 +6046,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -6200,7 +6154,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -6244,7 +6198,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierCollectionDocument" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, @@ -6306,7 +6260,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Assignee.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Assignee.cs index 0a34482d66..c9bcc15f64 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Assignee.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Assignee.cs @@ -23,14 +23,14 @@ public PersonAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public PersonRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(PersonAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(Assignee_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(PersonRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorResponseDocument.cs index 2a4711b7e3..c3654306b8 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorResponseDocument.cs @@ -27,14 +27,14 @@ public List Errors { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInErrorDocument? Links { - get { return BackingStore?.Get("links"); } + public ErrorTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInErrorDocument Links { - get { return BackingStore?.Get("links"); } + public ErrorTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -74,7 +74,7 @@ public static ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode pars public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"errors", n => { Errors = n.GetCollectionOfObjectValues(ErrorObject.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInErrorDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ErrorResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -85,7 +85,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("errors", Errors); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInErrorDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorTopLevelLinks.cs similarity index 89% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInErrorDocument.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorTopLevelLinks.cs index d9fba50feb..02bda2b836 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInErrorDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaClientExample.GeneratedCode.Models { - public class LinksInErrorDocument : IBackedModel, IParsable { + public class ErrorTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInErrorDocument and sets the default values. + /// Instantiates a new errorTopLevelLinks and sets the default values. /// - public LinksInErrorDocument() { + public ErrorTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInErrorDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInErrorDocument(); + return new ErrorTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullablePersonIdentifierResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullablePersonIdentifierResponseDocument.cs index df7f795d64..f4a3f072f7 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullablePersonIdentifierResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullablePersonIdentifierResponseDocument.cs @@ -26,14 +26,14 @@ public PersonIdentifier Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceIdentifierDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceIdentifierDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static NullablePersonIdentifierResponseDocument CreateFromDiscriminatorVa public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(PersonIdentifier.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceIdentifierDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NullablePersonIdentifierResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullablePersonSecondaryResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullablePersonSecondaryResponseDocument.cs index 8ca8cbccb6..4a4c4fedab 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullablePersonSecondaryResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullablePersonSecondaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(Assignee.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NullablePersonSecondaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableToOnePersonInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableToOnePersonInResponse.cs index 23fde34fc1..8b43090bdb 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableToOnePersonInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableToOnePersonInResponse.cs @@ -26,14 +26,14 @@ public PersonIdentifier Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static NullableToOnePersonInResponse CreateFromDiscriminatorValue(IParseN public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(PersonIdentifier.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NullableToOnePersonInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Owner.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Owner.cs index e9c38c5108..67ef7f8ffe 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Owner.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Owner.cs @@ -23,14 +23,14 @@ public PersonAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public PersonRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(PersonAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(Owner_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(PersonRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/People.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/People.cs index c11a6184b2..e730c1c9e9 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/People.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/People.cs @@ -23,14 +23,14 @@ public PersonAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public PersonRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(PersonAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(People_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(PersonRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonCollectionResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonCollectionResponseDocument.cs index 5821b24249..c75470839a 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonCollectionResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonCollectionResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(PersonDataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(PersonCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonDataInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonDataInResponse.cs index b91357f51c..779f710237 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonDataInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonDataInResponse.cs @@ -23,14 +23,14 @@ public PersonAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public PersonRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(PersonAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(PersonDataInResponse_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(PersonRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierResponseDocument.cs index 7446c07686..81fcd8fdd3 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierResponseDocument.cs @@ -26,14 +26,14 @@ public PersonIdentifier Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceIdentifierDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceIdentifierDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static PersonIdentifierResponseDocument CreateFromDiscriminatorValue(IPar public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(PersonIdentifier.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceIdentifierDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(PersonIdentifierResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonPrimaryResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonPrimaryResponseDocument.cs index bceff988c4..93d6ff2f90 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonPrimaryResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonPrimaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(People.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(PersonPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonSecondaryResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonSecondaryResponseDocument.cs index 0cbb879924..67ebfbf510 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonSecondaryResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonSecondaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(Owner.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(PersonSecondaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInRelationship.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipLinks.cs similarity index 89% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInRelationship.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipLinks.cs index c83d07bfdb..06c5a8d752 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInRelationship.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaClientExample.GeneratedCode.Models { - public class LinksInRelationship : IBackedModel, IParsable { + public class RelationshipLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The related property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInRelationship and sets the default values. + /// Instantiates a new relationshipLinks and sets the default values. /// - public LinksInRelationship() { + public RelationshipLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInRelationship CreateFromDiscriminatorValue(IParseNode parseNode) { + public static RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInRelationship(); + return new RelationshipLinks(); } /// /// The deserialization information for the current model diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceCollectionDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs similarity index 92% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceCollectionDocument.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs index 48ac519c04..5856e25307 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceCollectionDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaClientExample.GeneratedCode.Models { - public class LinksInResourceCollectionDocument : IBackedModel, IParsable { + public class ResourceCollectionTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -94,18 +94,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceCollectionDocument and sets the default values. + /// Instantiates a new resourceCollectionTopLevelLinks and sets the default values. /// - public LinksInResourceCollectionDocument() { + public ResourceCollectionTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceCollectionDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceCollectionDocument(); + return new ResourceCollectionTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceIdentifierCollectionDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs similarity index 92% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceIdentifierCollectionDocument.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs index 30176adee0..7fbfa70908 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceIdentifierCollectionDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaClientExample.GeneratedCode.Models { - public class LinksInResourceIdentifierCollectionDocument : IBackedModel, IParsable { + public class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -108,18 +108,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceIdentifierCollectionDocument and sets the default values. + /// Instantiates a new resourceIdentifierCollectionTopLevelLinks and sets the default values. /// - public LinksInResourceIdentifierCollectionDocument() { + public ResourceIdentifierCollectionTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceIdentifierCollectionDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceIdentifierCollectionDocument(); + return new ResourceIdentifierCollectionTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceIdentifierDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs similarity index 89% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceIdentifierDocument.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs index 0a67c50c39..bd76810832 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceIdentifierDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaClientExample.GeneratedCode.Models { - public class LinksInResourceIdentifierDocument : IBackedModel, IParsable { + public class ResourceIdentifierTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -52,18 +52,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceIdentifierDocument and sets the default values. + /// Instantiates a new resourceIdentifierTopLevelLinks and sets the default values. /// - public LinksInResourceIdentifierDocument() { + public ResourceIdentifierTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceIdentifierDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceIdentifierTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceIdentifierDocument(); + return new ResourceIdentifierTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceData.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceLinks.cs similarity index 86% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceData.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceLinks.cs index 89756e3093..64bff863a7 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceData.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaClientExample.GeneratedCode.Models { - public class LinksInResourceData : IBackedModel, IParsable { + public class ResourceLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The self property @@ -24,18 +24,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceData and sets the default values. + /// Instantiates a new resourceLinks and sets the default values. /// - public LinksInResourceData() { + public ResourceLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceData CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceData(); + return new ResourceLinks(); } /// /// The deserialization information for the current model diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceTopLevelLinks.cs similarity index 88% rename from src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceDocument.cs rename to src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceTopLevelLinks.cs index 1d41ffcd7b..a240dc656e 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/LinksInResourceDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaClientExample.GeneratedCode.Models { - public class LinksInResourceDocument : IBackedModel, IParsable { + public class ResourceTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceDocument and sets the default values. + /// Instantiates a new resourceTopLevelLinks and sets the default values. /// - public LinksInResourceDocument() { + public ResourceTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceDocument(); + return new ResourceTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagCollectionResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagCollectionResponseDocument.cs index 645211b54c..ac18359f7f 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagCollectionResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagCollectionResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(TagDataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(TagCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagDataInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagDataInResponse.cs index 42d529b36f..f34a8c976a 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagDataInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagDataInResponse.cs @@ -23,14 +23,14 @@ public TagAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public TagRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(TagAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(TagDataInResponse_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(TagRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierCollectionResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierCollectionResponseDocument.cs index 33c43abc2d..8288a500f4 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierCollectionResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierCollectionResponseDocument.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceIdentifierCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceIdentifierCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static TagIdentifierCollectionResponseDocument CreateFromDiscriminatorVal public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(TagIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceIdentifierCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(TagIdentifierCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagPrimaryResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagPrimaryResponseDocument.cs index 63d111046d..62ef81018e 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagPrimaryResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagPrimaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(Tags.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(TagPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Tags.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Tags.cs index e4454f9087..4add048134 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Tags.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Tags.cs @@ -23,14 +23,14 @@ public TagAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public TagRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(TagAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(Tags_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(TagRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTagInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTagInResponse.cs index 68d7a927ca..92f0f9db42 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTagInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTagInResponse.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static ToManyTagInResponse CreateFromDiscriminatorValue(IParseNode parseN public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(TagIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ToManyTagInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTodoItemInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTodoItemInResponse.cs index a53c7a0c5a..bf4fe23cb7 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTodoItemInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTodoItemInResponse.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static ToManyTodoItemInResponse CreateFromDiscriminatorValue(IParseNode p public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(TodoItemIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ToManyTodoItemInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToOnePersonInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToOnePersonInResponse.cs index 14e4db99bb..d920a81e1f 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToOnePersonInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToOnePersonInResponse.cs @@ -26,14 +26,14 @@ public PersonIdentifier Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static ToOnePersonInResponse CreateFromDiscriminatorValue(IParseNode pars public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(PersonIdentifier.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ToOnePersonInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemCollectionResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemCollectionResponseDocument.cs index eeb262fb88..90f233f2c6 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemCollectionResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemCollectionResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(TodoItemDataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(TodoItemCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemDataInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemDataInResponse.cs index 86ae33ca73..39f02aa0ce 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemDataInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemDataInResponse.cs @@ -23,14 +23,14 @@ public TodoItemAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public TodoItemRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(TodoItemAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(TodoItemDataInResponse_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(TodoItemRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierCollectionResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierCollectionResponseDocument.cs index 4fb118bbc9..83804f1054 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierCollectionResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierCollectionResponseDocument.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceIdentifierCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceIdentifierCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static TodoItemIdentifierCollectionResponseDocument CreateFromDiscriminat public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(TodoItemIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceIdentifierCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(TodoItemIdentifierCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemPrimaryResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemPrimaryResponseDocument.cs index 035d354623..242fc5f280 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemPrimaryResponseDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemPrimaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(TodoItems.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(TodoItemPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItems.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItems.cs index 2f2163761b..d90e92b8d0 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItems.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItems.cs @@ -23,14 +23,14 @@ public TodoItemAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public TodoItemRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(TodoItemAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(TodoItems_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(TodoItemRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/src/JsonApiDotNetCore.OpenApi/ConfigureSwaggerGenOptions.cs b/src/JsonApiDotNetCore.OpenApi/ConfigureSwaggerGenOptions.cs index 3a11157978..2ba47ef0d4 100644 --- a/src/JsonApiDotNetCore.OpenApi/ConfigureSwaggerGenOptions.cs +++ b/src/JsonApiDotNetCore.OpenApi/ConfigureSwaggerGenOptions.cs @@ -47,6 +47,7 @@ public void Configure(SwaggerGenOptions options) options.DocumentFilter(); options.DocumentFilter(); options.OperationFilter(); + options.DocumentFilter(); } private IEnumerable GetConstructedTypesForResourceData(Type baseType) diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ErrorResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ErrorResponseDocument.cs index c4b79fa9f7..b72f4e30b9 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ErrorResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ErrorResponseDocument.cs @@ -14,7 +14,7 @@ internal sealed class ErrorResponseDocument [Required] [JsonPropertyName("links")] - public LinksInErrorDocument Links { get; set; } = null!; + public ErrorTopLevelLinks Links { get; set; } = null!; [Required] [JsonPropertyName("errors")] diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/NullableResourceIdentifierResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/NullableResourceIdentifierResponseDocument.cs index f5b1bee34a..12eeee42fd 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/NullableResourceIdentifierResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/NullableResourceIdentifierResponseDocument.cs @@ -18,7 +18,7 @@ internal sealed class NullableResourceIdentifierResponseDocument : Nu [Required] [JsonPropertyName("links")] - public LinksInResourceIdentifierDocument Links { get; set; } = null!; + public ResourceIdentifierTopLevelLinks Links { get; set; } = null!; [JsonPropertyName("meta")] public IDictionary Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/NullableSecondaryResourceResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/NullableSecondaryResourceResponseDocument.cs index 846cb2abbe..a6a9551428 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/NullableSecondaryResourceResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/NullableSecondaryResourceResponseDocument.cs @@ -16,7 +16,7 @@ internal sealed class NullableSecondaryResourceResponseDocument : Nul [Required] [JsonPropertyName("links")] - public LinksInResourceDocument Links { get; set; } = null!; + public ResourceTopLevelLinks Links { get; set; } = null!; [JsonPropertyName("included")] public IList Included { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/PrimaryResourceResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/PrimaryResourceResponseDocument.cs index b4c5350a9a..da834d2070 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/PrimaryResourceResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/PrimaryResourceResponseDocument.cs @@ -16,7 +16,7 @@ internal sealed class PrimaryResourceResponseDocument : SingleData Included { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ResourceCollectionResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ResourceCollectionResponseDocument.cs index 9eb76586a1..3f92d06059 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ResourceCollectionResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ResourceCollectionResponseDocument.cs @@ -16,7 +16,7 @@ internal sealed class ResourceCollectionResponseDocument : ManyData Included { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ResourceIdentifierCollectionResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ResourceIdentifierCollectionResponseDocument.cs index ed262ca324..b423fad146 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ResourceIdentifierCollectionResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ResourceIdentifierCollectionResponseDocument.cs @@ -16,7 +16,7 @@ internal sealed class ResourceIdentifierCollectionResponseDocument : [Required] [JsonPropertyName("links")] - public LinksInResourceIdentifierCollectionDocument Links { get; set; } = null!; + public ResourceIdentifierCollectionTopLevelLinks Links { get; set; } = null!; [JsonPropertyName("meta")] public IDictionary Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ResourceIdentifierResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ResourceIdentifierResponseDocument.cs index be16ed69ef..5d0d741c7b 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ResourceIdentifierResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/ResourceIdentifierResponseDocument.cs @@ -16,7 +16,7 @@ internal sealed class ResourceIdentifierResponseDocument : SingleData [Required] [JsonPropertyName("links")] - public LinksInResourceIdentifierDocument Links { get; set; } = null!; + public ResourceIdentifierTopLevelLinks Links { get; set; } = null!; [JsonPropertyName("meta")] public IDictionary Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/SecondaryResourceResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/SecondaryResourceResponseDocument.cs index 6d6db39bce..9c26fea16e 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/SecondaryResourceResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Documents/SecondaryResourceResponseDocument.cs @@ -16,7 +16,7 @@ internal sealed class SecondaryResourceResponseDocument : SingleData< [Required] [JsonPropertyName("links")] - public LinksInResourceDocument Links { get; set; } = null!; + public ResourceTopLevelLinks Links { get; set; } = null!; [JsonPropertyName("included")] public IList Included { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInErrorDocument.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ErrorTopLevelLinks.cs similarity index 77% rename from src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInErrorDocument.cs rename to src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ErrorTopLevelLinks.cs index 2d3c075050..9f708c23e7 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInErrorDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ErrorTopLevelLinks.cs @@ -1,13 +1,11 @@ -using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; using JetBrains.Annotations; namespace JsonApiDotNetCore.OpenApi.JsonApiObjects.Links; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class LinksInErrorDocument +internal sealed class ErrorTopLevelLinks { - [Required] [JsonPropertyName("self")] public string Self { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInRelationship.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/RelationshipLinks.cs similarity index 74% rename from src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInRelationship.cs rename to src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/RelationshipLinks.cs index f67c02f79b..899ce9f916 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInRelationship.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/RelationshipLinks.cs @@ -1,17 +1,14 @@ -using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; using JetBrains.Annotations; namespace JsonApiDotNetCore.OpenApi.JsonApiObjects.Links; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class LinksInRelationship +internal sealed class RelationshipLinks { - [Required] [JsonPropertyName("self")] public string Self { get; set; } = null!; - [Required] [JsonPropertyName("related")] public string Related { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceCollectionDocument.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceCollectionTopLevelLinks.cs similarity index 85% rename from src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceCollectionDocument.cs rename to src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceCollectionTopLevelLinks.cs index ee9c9d31df..fd39b744e2 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceCollectionDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceCollectionTopLevelLinks.cs @@ -1,13 +1,11 @@ -using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; using JetBrains.Annotations; namespace JsonApiDotNetCore.OpenApi.JsonApiObjects.Links; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class LinksInResourceCollectionDocument +internal sealed class ResourceCollectionTopLevelLinks { - [Required] [JsonPropertyName("self")] public string Self { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceIdentifierCollectionDocument.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceIdentifierCollectionTopLevelLinks.cs similarity index 84% rename from src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceIdentifierCollectionDocument.cs rename to src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceIdentifierCollectionTopLevelLinks.cs index ca32345e55..c64350628a 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceIdentifierCollectionDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceIdentifierCollectionTopLevelLinks.cs @@ -1,17 +1,14 @@ -using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; using JetBrains.Annotations; namespace JsonApiDotNetCore.OpenApi.JsonApiObjects.Links; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class LinksInResourceIdentifierCollectionDocument +internal sealed class ResourceIdentifierCollectionTopLevelLinks { - [Required] [JsonPropertyName("self")] public string Self { get; set; } = null!; - [Required] [JsonPropertyName("related")] public string Related { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceIdentifierDocument.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceIdentifierTopLevelLinks.cs similarity index 76% rename from src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceIdentifierDocument.cs rename to src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceIdentifierTopLevelLinks.cs index 94814316f6..86a0e31b5e 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceIdentifierDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceIdentifierTopLevelLinks.cs @@ -1,17 +1,14 @@ -using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; using JetBrains.Annotations; namespace JsonApiDotNetCore.OpenApi.JsonApiObjects.Links; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class LinksInResourceIdentifierDocument +internal sealed class ResourceIdentifierTopLevelLinks { - [Required] [JsonPropertyName("self")] public string Self { get; set; } = null!; - [Required] [JsonPropertyName("related")] public string Related { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceData.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceLinks.cs similarity index 71% rename from src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceData.cs rename to src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceLinks.cs index 95d55fc545..8a01483133 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceData.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceLinks.cs @@ -1,13 +1,11 @@ -using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; using JetBrains.Annotations; namespace JsonApiDotNetCore.OpenApi.JsonApiObjects.Links; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class LinksInResourceData +internal sealed class ResourceLinks { - [Required] [JsonPropertyName("self")] public string Self { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceDocument.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceTopLevelLinks.cs similarity index 76% rename from src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceDocument.cs rename to src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceTopLevelLinks.cs index b83e59fa4d..f621961737 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/LinksInResourceDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Links/ResourceTopLevelLinks.cs @@ -1,13 +1,11 @@ -using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; using JetBrains.Annotations; namespace JsonApiDotNetCore.OpenApi.JsonApiObjects.Links; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class LinksInResourceDocument +internal sealed class ResourceTopLevelLinks { - [Required] [JsonPropertyName("self")] public string Self { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Relationships/NullableToOneRelationshipInResponse.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Relationships/NullableToOneRelationshipInResponse.cs index ae0a6ed539..a2e6cc63ac 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Relationships/NullableToOneRelationshipInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Relationships/NullableToOneRelationshipInResponse.cs @@ -1,4 +1,3 @@ -using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; using JetBrains.Annotations; using JsonApiDotNetCore.OpenApi.JsonApiObjects.Links; @@ -11,9 +10,9 @@ namespace JsonApiDotNetCore.OpenApi.JsonApiObjects.Relationships; internal sealed class NullableToOneRelationshipInResponse : NullableSingleData> where TResource : IIdentifiable { - [Required] + // Non-required because the related controller may be unavailable when used in an include. [JsonPropertyName("links")] - public LinksInRelationship Links { get; set; } = null!; + public RelationshipLinks Links { get; set; } = null!; [JsonPropertyName("meta")] public IDictionary Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Relationships/ToManyRelationshipInResponse.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Relationships/ToManyRelationshipInResponse.cs index 51436b463c..b78b52dbce 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Relationships/ToManyRelationshipInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Relationships/ToManyRelationshipInResponse.cs @@ -1,4 +1,3 @@ -using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; using JetBrains.Annotations; using JsonApiDotNetCore.OpenApi.JsonApiObjects.Links; @@ -11,9 +10,9 @@ namespace JsonApiDotNetCore.OpenApi.JsonApiObjects.Relationships; internal sealed class ToManyRelationshipInResponse : ManyData> where TResource : IIdentifiable { - [Required] + // Non-required because the related controller may be unavailable when used in an include. [JsonPropertyName("links")] - public LinksInRelationship Links { get; set; } = null!; + public RelationshipLinks Links { get; set; } = null!; [JsonPropertyName("meta")] public IDictionary Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Relationships/ToOneRelationshipInResponse.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Relationships/ToOneRelationshipInResponse.cs index 94b11f630e..64a3fcf881 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Relationships/ToOneRelationshipInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/Relationships/ToOneRelationshipInResponse.cs @@ -1,4 +1,3 @@ -using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; using JetBrains.Annotations; using JsonApiDotNetCore.OpenApi.JsonApiObjects.Links; @@ -11,9 +10,9 @@ namespace JsonApiDotNetCore.OpenApi.JsonApiObjects.Relationships; internal sealed class ToOneRelationshipInResponse : SingleData> where TResource : IIdentifiable { - [Required] + // Non-required because the related controller may be unavailable when used in an include. [JsonPropertyName("links")] - public LinksInRelationship Links { get; set; } = null!; + public RelationshipLinks Links { get; set; } = null!; [JsonPropertyName("meta")] public IDictionary Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/ResourceObjects/ResourceDataInResponse.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/ResourceObjects/ResourceDataInResponse.cs index 948e3182de..8a7e6d5748 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/ResourceObjects/ResourceDataInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiObjects/ResourceObjects/ResourceDataInResponse.cs @@ -15,9 +15,9 @@ internal sealed class ResourceDataInResponse : ResourceData [JsonPropertyName("relationships")] public RelationshipsInResponse Relationships { get; set; } = null!; - // This would normally be { "self": "/people/5" } for GET /todoItems/1/assignee, but it is null when PeopleController is unavailable. + // Non-required because the related controller may be unavailable when used in an include. [JsonPropertyName("links")] - public LinksInResourceData Links { get; set; } = null!; + public ResourceLinks Links { get; set; } = null!; [JsonPropertyName("meta")] public IDictionary Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi/JsonApiSchemaIdSelector.cs b/src/JsonApiDotNetCore.OpenApi/JsonApiSchemaIdSelector.cs index cd9816fbde..f83a736a30 100644 --- a/src/JsonApiDotNetCore.OpenApi/JsonApiSchemaIdSelector.cs +++ b/src/JsonApiDotNetCore.OpenApi/JsonApiSchemaIdSelector.cs @@ -84,7 +84,7 @@ public string GetSchemaId(Type type) } } - // Used for a fixed set of non-generic types, such as Jsonapi, LinksInResourceCollectionDocument etc. + // Used for a fixed set of non-generic types, such as Jsonapi, ResourceCollectionTopLevelLinks etc. return ApplySchemaTemplate(type.Name, null); } diff --git a/src/JsonApiDotNetCore.OpenApi/ServiceCollectionExtensions.cs b/src/JsonApiDotNetCore.OpenApi/ServiceCollectionExtensions.cs index a605e1daba..8168b56e04 100644 --- a/src/JsonApiDotNetCore.OpenApi/ServiceCollectionExtensions.cs +++ b/src/JsonApiDotNetCore.OpenApi/ServiceCollectionExtensions.cs @@ -92,5 +92,6 @@ private static void AddSchemaGenerators(IServiceCollection services) services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); + services.TryAddSingleton(); } } diff --git a/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/DocumentSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/DocumentSchemaGenerator.cs index 5df0994903..daec740e51 100644 --- a/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/DocumentSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/DocumentSchemaGenerator.cs @@ -31,17 +31,19 @@ internal sealed class DocumentSchemaGenerator private readonly SchemaGenerator _defaultSchemaGenerator; private readonly AbstractResourceDataSchemaGenerator _abstractResourceDataSchemaGenerator; private readonly ResourceDataSchemaGenerator _resourceDataSchemaGenerator; + private readonly LinksVisibilitySchemaGenerator _linksVisibilitySchemaGenerator; private readonly IncludeDependencyScanner _includeDependencyScanner; private readonly IResourceGraph _resourceGraph; private readonly IJsonApiOptions _options; public DocumentSchemaGenerator(SchemaGenerator defaultSchemaGenerator, AbstractResourceDataSchemaGenerator abstractResourceDataSchemaGenerator, - ResourceDataSchemaGenerator resourceDataSchemaGenerator, IncludeDependencyScanner includeDependencyScanner, IResourceGraph resourceGraph, - IJsonApiOptions options) + ResourceDataSchemaGenerator resourceDataSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, + IncludeDependencyScanner includeDependencyScanner, IResourceGraph resourceGraph, IJsonApiOptions options) { ArgumentGuard.NotNull(defaultSchemaGenerator); ArgumentGuard.NotNull(abstractResourceDataSchemaGenerator); ArgumentGuard.NotNull(resourceDataSchemaGenerator); + ArgumentGuard.NotNull(linksVisibilitySchemaGenerator); ArgumentGuard.NotNull(includeDependencyScanner); ArgumentGuard.NotNull(resourceGraph); ArgumentGuard.NotNull(options); @@ -49,6 +51,7 @@ public DocumentSchemaGenerator(SchemaGenerator defaultSchemaGenerator, AbstractR _defaultSchemaGenerator = defaultSchemaGenerator; _abstractResourceDataSchemaGenerator = abstractResourceDataSchemaGenerator; _resourceDataSchemaGenerator = resourceDataSchemaGenerator; + _linksVisibilitySchemaGenerator = linksVisibilitySchemaGenerator; _includeDependencyScanner = includeDependencyScanner; _resourceGraph = resourceGraph; _options = options; @@ -65,10 +68,12 @@ public OpenApiSchema GenerateSchema(Type modelType, SchemaRepository schemaRepos OpenApiSchema fullSchemaForDocument = schemaRepository.Schemas[referenceSchemaForDocument.Reference.Id]; - fullSchemaForDocument.SetValuesInMetaToNullable(); - SetJsonApiVersion(fullSchemaForDocument, schemaRepository); + _linksVisibilitySchemaGenerator.UpdateSchemaForTopLevel(modelType, fullSchemaForDocument, schemaRepository); + + fullSchemaForDocument.SetValuesInMetaToNullable(); + return referenceSchemaForDocument; } @@ -163,7 +168,6 @@ private void SetJsonApiVersion(OpenApiSchema fullSchemaForDocument, SchemaReposi if (!_options.IncludeJsonApiVersion) { fullSchemaForDocument.Properties.Remove(JsonApiPropertyName.Jsonapi); - schemaRepository.Schemas.Remove(jsonapiSchemaId); } else { diff --git a/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/LinksVisibilitySchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/LinksVisibilitySchemaGenerator.cs new file mode 100644 index 0000000000..9cfdaba0bf --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/LinksVisibilitySchemaGenerator.cs @@ -0,0 +1,203 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.JsonApiObjects.Documents; +using JsonApiDotNetCore.OpenApi.JsonApiObjects.Relationships; +using JsonApiDotNetCore.OpenApi.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources.Annotations; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.SwaggerComponents; + +/// +/// Hides links that are never returned. +/// +/// +/// Tradeoff: Special-casing links per resource type and per relationship means an explosion of expanded types, only because the links visibility may +/// vary. Furthermore, relationship links fallback to their left-type resource, whereas we generate right-type component schemas for relationships. To +/// keep it simple, we take the union of exposed links on resource types and relationships. Only what's not in this unification gets hidden. For example, +/// when options == None, typeof(Blogs) == Self, and typeof(Posts) == Related, we'll keep Self | Related for both Blogs and Posts, and remove any other +/// links. +/// +internal sealed class LinksVisibilitySchemaGenerator +{ + private const LinkTypes ResourceTopLinkTypes = LinkTypes.Self | LinkTypes.DescribedBy; + private const LinkTypes ResourceCollectionTopLinkTypes = LinkTypes.Self | LinkTypes.DescribedBy | LinkTypes.Pagination; + private const LinkTypes ResourceIdentifierTopLinkTypes = LinkTypes.Self | LinkTypes.Related | LinkTypes.DescribedBy; + private const LinkTypes ResourceIdentifierCollectionTopLinkTypes = LinkTypes.Self | LinkTypes.Related | LinkTypes.DescribedBy | LinkTypes.Pagination; + private const LinkTypes ErrorTopLinkTypes = LinkTypes.Self | LinkTypes.DescribedBy; + private const LinkTypes RelationshipLinkTypes = LinkTypes.Self | LinkTypes.Related; + private const LinkTypes ResourceLinkTypes = LinkTypes.Self; + + private static readonly Dictionary LinksInJsonApiComponentTypes = new() + { + [typeof(NullableSecondaryResourceResponseDocument<>)] = ResourceTopLinkTypes, + [typeof(PrimaryResourceResponseDocument<>)] = ResourceTopLinkTypes, + [typeof(SecondaryResourceResponseDocument<>)] = ResourceTopLinkTypes, + [typeof(ResourceCollectionResponseDocument<>)] = ResourceCollectionTopLinkTypes, + [typeof(ResourceIdentifierResponseDocument<>)] = ResourceIdentifierTopLinkTypes, + [typeof(NullableResourceIdentifierResponseDocument<>)] = ResourceIdentifierTopLinkTypes, + [typeof(ResourceIdentifierCollectionResponseDocument<>)] = ResourceIdentifierCollectionTopLinkTypes, + [typeof(ErrorResponseDocument)] = ErrorTopLinkTypes, + [typeof(NullableToOneRelationshipInResponse<>)] = RelationshipLinkTypes, + [typeof(ToManyRelationshipInResponse<>)] = RelationshipLinkTypes, + [typeof(ToOneRelationshipInResponse<>)] = RelationshipLinkTypes, + [typeof(ResourceDataInResponse<>)] = ResourceLinkTypes + }; + + private static readonly Dictionary> LinkTypeToPropertyNamesMap = new() + { + [LinkTypes.Self] = ["self"], + [LinkTypes.Related] = ["related"], + [LinkTypes.DescribedBy] = ["describedby"], + [LinkTypes.Pagination] = + [ + "first", + "last", + "prev", + "next" + ] + }; + + private readonly Lazy _lazyLinksVisibility; + + public LinksVisibilitySchemaGenerator(IResourceGraph resourceGraph, IJsonApiOptions options) + { + ArgumentGuard.NotNull(resourceGraph); + ArgumentGuard.NotNull(options); + + _lazyLinksVisibility = new Lazy(() => new LinksVisibility(resourceGraph, options), LazyThreadSafetyMode.ExecutionAndPublication); + } + + public void UpdateSchemaForTopLevel(Type modelType, OpenApiSchema fullSchemaForLinksContainer, SchemaRepository schemaRepository) + { + ArgumentGuard.NotNull(modelType); + ArgumentGuard.NotNull(fullSchemaForLinksContainer); + + Type lookupType = modelType.IsConstructedGenericType ? modelType.GetGenericTypeDefinition() : modelType; + + if (LinksInJsonApiComponentTypes.TryGetValue(lookupType, out LinkTypes possibleLinkTypes)) + { + UpdateLinksProperty(fullSchemaForLinksContainer, _lazyLinksVisibility.Value.TopLevelLinks, possibleLinkTypes, schemaRepository); + } + } + + public void UpdateSchemaForResource(ResourceTypeInfo resourceTypeInfo, OpenApiSchema fullSchemaForResourceData, SchemaRepository schemaRepository) + { + ArgumentGuard.NotNull(resourceTypeInfo); + ArgumentGuard.NotNull(fullSchemaForResourceData); + + if (LinksInJsonApiComponentTypes.TryGetValue(resourceTypeInfo.ResourceDataOpenType, out LinkTypes possibleLinkTypes)) + { + UpdateLinksProperty(fullSchemaForResourceData, _lazyLinksVisibility.Value.ResourceLinks, possibleLinkTypes, schemaRepository); + } + } + + public void UpdateSchemaForRelationship(Type modelType, OpenApiSchema fullSchemaForRelationship, SchemaRepository schemaRepository) + { + ArgumentGuard.NotNull(modelType); + ArgumentGuard.NotNull(fullSchemaForRelationship); + + Type lookupType = modelType.GetGenericTypeDefinition(); + + if (LinksInJsonApiComponentTypes.TryGetValue(lookupType, out LinkTypes possibleLinkTypes)) + { + UpdateLinksProperty(fullSchemaForRelationship, _lazyLinksVisibility.Value.RelationshipLinks, possibleLinkTypes, schemaRepository); + } + } + + private void UpdateLinksProperty(OpenApiSchema fullSchemaForLinksContainer, LinkTypes visibleLinkTypes, LinkTypes possibleLinkTypes, + SchemaRepository schemaRepository) + { + if ((visibleLinkTypes & possibleLinkTypes) == 0) + { + fullSchemaForLinksContainer.Required.Remove(JsonApiPropertyName.Links); + fullSchemaForLinksContainer.Properties.Remove(JsonApiPropertyName.Links); + } + else if (visibleLinkTypes != possibleLinkTypes) + { + OpenApiSchema referenceSchemaForLinks = fullSchemaForLinksContainer.Properties[JsonApiPropertyName.Links]; + string linksSchemaId = referenceSchemaForLinks.AllOf[0].Reference.Id; + + if (schemaRepository.Schemas.TryGetValue(linksSchemaId, out OpenApiSchema? fullSchemaForLinks)) + { + UpdateLinkProperties(fullSchemaForLinks, visibleLinkTypes); + } + } + } + + private void UpdateLinkProperties(OpenApiSchema fullSchemaForLinks, LinkTypes availableLinkTypes) + { + foreach (string propertyName in LinkTypeToPropertyNamesMap.Where(pair => !availableLinkTypes.HasFlag(pair.Key)).SelectMany(pair => pair.Value)) + { + fullSchemaForLinks.Required.Remove(propertyName); + fullSchemaForLinks.Properties.Remove(propertyName); + } + } + + private sealed class LinksVisibility + { + public LinkTypes TopLevelLinks { get; } + public LinkTypes ResourceLinks { get; } + public LinkTypes RelationshipLinks { get; } + + public LinksVisibility(IResourceGraph resourceGraph, IJsonApiOptions options) + { + ArgumentGuard.NotNull(resourceGraph); + ArgumentGuard.NotNull(options); + + var unionTopLevelLinks = LinkTypes.None; + var unionResourceLinks = LinkTypes.None; + var unionRelationshipLinks = LinkTypes.None; + + foreach (ResourceType resourceType in resourceGraph.GetResourceTypes()) + { + LinkTypes topLevelLinks = GetTopLevelLinks(resourceType, options); + unionTopLevelLinks |= topLevelLinks; + + LinkTypes resourceLinks = GetResourceLinks(resourceType, options); + unionResourceLinks |= resourceLinks; + + LinkTypes relationshipLinks = GetRelationshipLinks(resourceType, options); + unionRelationshipLinks |= relationshipLinks; + } + + TopLevelLinks = Normalize(unionTopLevelLinks); + ResourceLinks = Normalize(unionResourceLinks); + RelationshipLinks = Normalize(unionRelationshipLinks); + } + + private LinkTypes GetTopLevelLinks(ResourceType resourceType, IJsonApiOptions options) + { + return resourceType.TopLevelLinks != LinkTypes.NotConfigured ? resourceType.TopLevelLinks : + options.TopLevelLinks == LinkTypes.NotConfigured ? LinkTypes.None : options.TopLevelLinks; + } + + private LinkTypes GetResourceLinks(ResourceType resourceType, IJsonApiOptions options) + { + return resourceType.ResourceLinks != LinkTypes.NotConfigured ? resourceType.ResourceLinks : + options.ResourceLinks == LinkTypes.NotConfigured ? LinkTypes.None : options.ResourceLinks; + } + + private LinkTypes GetRelationshipLinks(ResourceType resourceType, IJsonApiOptions options) + { + LinkTypes unionRelationshipLinks = resourceType.RelationshipLinks != LinkTypes.NotConfigured ? resourceType.RelationshipLinks : + options.RelationshipLinks == LinkTypes.NotConfigured ? LinkTypes.None : options.RelationshipLinks; + + foreach (RelationshipAttribute relationship in resourceType.Relationships) + { + LinkTypes relationshipLinks = relationship.Links != LinkTypes.NotConfigured ? relationship.Links : + relationship.LeftType.RelationshipLinks != LinkTypes.NotConfigured ? relationship.LeftType.RelationshipLinks : + options.RelationshipLinks == LinkTypes.NotConfigured ? LinkTypes.None : options.RelationshipLinks; + + unionRelationshipLinks |= relationshipLinks; + } + + return unionRelationshipLinks; + } + + private static LinkTypes Normalize(LinkTypes linkTypes) + { + return linkTypes != LinkTypes.None ? linkTypes & ~LinkTypes.None : linkTypes; + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/ResourceDataSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/ResourceDataSchemaGenerator.cs index 8fd577ab91..3db1bc7fe1 100644 --- a/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/ResourceDataSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/ResourceDataSchemaGenerator.cs @@ -22,6 +22,7 @@ internal sealed class ResourceDataSchemaGenerator private readonly SchemaGenerator _defaultSchemaGenerator; private readonly ResourceTypeSchemaGenerator _resourceTypeSchemaGenerator; private readonly ResourceIdentifierSchemaGenerator _resourceIdentifierSchemaGenerator; + private readonly LinksVisibilitySchemaGenerator _linksVisibilitySchemaGenerator; private readonly IResourceGraph _resourceGraph; private readonly IJsonApiOptions _options; private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; @@ -29,13 +30,14 @@ internal sealed class ResourceDataSchemaGenerator private readonly ResourceDocumentationReader _resourceDocumentationReader; public ResourceDataSchemaGenerator(SchemaGenerator defaultSchemaGenerator, ResourceTypeSchemaGenerator resourceTypeSchemaGenerator, - ResourceIdentifierSchemaGenerator resourceIdentifierSchemaGenerator, IResourceGraph resourceGraph, IJsonApiOptions options, - ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, RelationshipTypeFactory relationshipTypeFactory, - ResourceDocumentationReader resourceDocumentationReader) + ResourceIdentifierSchemaGenerator resourceIdentifierSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, + IResourceGraph resourceGraph, IJsonApiOptions options, ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, + RelationshipTypeFactory relationshipTypeFactory, ResourceDocumentationReader resourceDocumentationReader) { ArgumentGuard.NotNull(defaultSchemaGenerator); ArgumentGuard.NotNull(resourceTypeSchemaGenerator); ArgumentGuard.NotNull(resourceIdentifierSchemaGenerator); + ArgumentGuard.NotNull(linksVisibilitySchemaGenerator); ArgumentGuard.NotNull(resourceGraph); ArgumentGuard.NotNull(options); ArgumentGuard.NotNull(resourceFieldValidationMetadataProvider); @@ -45,6 +47,7 @@ public ResourceDataSchemaGenerator(SchemaGenerator defaultSchemaGenerator, Resou _defaultSchemaGenerator = defaultSchemaGenerator; _resourceTypeSchemaGenerator = resourceTypeSchemaGenerator; _resourceIdentifierSchemaGenerator = resourceIdentifierSchemaGenerator; + _linksVisibilitySchemaGenerator = linksVisibilitySchemaGenerator; _resourceGraph = resourceGraph; _options = options; _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; @@ -68,7 +71,7 @@ public OpenApiSchema GenerateSchema(Type resourceDataConstructedType, SchemaRepo var resourceTypeInfo = ResourceTypeInfo.Create(resourceDataConstructedType, _resourceGraph); - var fieldSchemaBuilder = new ResourceFieldSchemaBuilder(_defaultSchemaGenerator, _resourceIdentifierSchemaGenerator, + var fieldSchemaBuilder = new ResourceFieldSchemaBuilder(_defaultSchemaGenerator, _resourceIdentifierSchemaGenerator, _linksVisibilitySchemaGenerator, _resourceFieldValidationMetadataProvider, _relationshipTypeFactory, resourceTypeInfo); OpenApiSchema effectiveFullSchemaForResourceData = @@ -82,11 +85,13 @@ public OpenApiSchema GenerateSchema(Type resourceDataConstructedType, SchemaRepo fullSchemaForResourceData.Description = _resourceDocumentationReader.GetDocumentationForType(resourceTypeInfo.ResourceType); - effectiveFullSchemaForResourceData.SetValuesInMetaToNullable(); - SetResourceAttributes(effectiveFullSchemaForResourceData, fieldSchemaBuilder, schemaRepository); SetResourceRelationships(effectiveFullSchemaForResourceData, fieldSchemaBuilder, schemaRepository); + _linksVisibilitySchemaGenerator.UpdateSchemaForResource(resourceTypeInfo, effectiveFullSchemaForResourceData, schemaRepository); + + effectiveFullSchemaForResourceData.SetValuesInMetaToNullable(); + effectiveFullSchemaForResourceData.ReorderProperties(ResourceDataPropertyNamesInOrder); return referenceSchemaForResourceData; @@ -125,7 +130,6 @@ private void SetResourceAttributes(OpenApiSchema fullSchemaForResourceData, Reso if (!fullSchemaForAttributes.Properties.Any()) { fullSchemaForResourceData.Properties.Remove(JsonApiPropertyName.Attributes); - schemaRepository.Schemas.Remove(referenceSchemaForAttributes.Reference.Id); } else { @@ -143,7 +147,6 @@ private void SetResourceRelationships(OpenApiSchema fullSchemaForResourceData, R if (!fullSchemaForRelationships.Properties.Any()) { fullSchemaForResourceData.Properties.Remove(JsonApiPropertyName.Relationships); - schemaRepository.Schemas.Remove(referenceSchemaForRelationships.Reference.Id); } else { diff --git a/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/ResourceFieldSchemaBuilder.cs b/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/ResourceFieldSchemaBuilder.cs index 89936d43d6..5b94bbeb23 100644 --- a/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/ResourceFieldSchemaBuilder.cs +++ b/src/JsonApiDotNetCore.OpenApi/SwaggerComponents/ResourceFieldSchemaBuilder.cs @@ -33,6 +33,7 @@ internal sealed class ResourceFieldSchemaBuilder private readonly SchemaGenerator _defaultSchemaGenerator; private readonly ResourceIdentifierSchemaGenerator _resourceIdentifierSchemaGenerator; + private readonly LinksVisibilitySchemaGenerator _linksVisibilitySchemaGenerator; private readonly ResourceTypeInfo _resourceTypeInfo; private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; private readonly RelationshipTypeFactory _relationshipTypeFactory; @@ -42,17 +43,19 @@ internal sealed class ResourceFieldSchemaBuilder private readonly IDictionary _schemasForResourceFields; public ResourceFieldSchemaBuilder(SchemaGenerator defaultSchemaGenerator, ResourceIdentifierSchemaGenerator resourceIdentifierSchemaGenerator, - ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, RelationshipTypeFactory relationshipTypeFactory, - ResourceTypeInfo resourceTypeInfo) + LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, + RelationshipTypeFactory relationshipTypeFactory, ResourceTypeInfo resourceTypeInfo) { ArgumentGuard.NotNull(defaultSchemaGenerator); ArgumentGuard.NotNull(resourceIdentifierSchemaGenerator); + ArgumentGuard.NotNull(linksVisibilitySchemaGenerator); ArgumentGuard.NotNull(resourceTypeInfo); ArgumentGuard.NotNull(resourceFieldValidationMetadataProvider); ArgumentGuard.NotNull(relationshipTypeFactory); _defaultSchemaGenerator = defaultSchemaGenerator; _resourceIdentifierSchemaGenerator = resourceIdentifierSchemaGenerator; + _linksVisibilitySchemaGenerator = linksVisibilitySchemaGenerator; _resourceTypeInfo = resourceTypeInfo; _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; _relationshipTypeFactory = relationshipTypeFactory; @@ -216,6 +219,8 @@ private OpenApiSchema CreateRelationshipReferenceSchema(Type relationshipSchemaT if (IsRelationshipInResponseType(relationshipSchemaType)) { + _linksVisibilitySchemaGenerator.UpdateSchemaForRelationship(relationshipSchemaType, fullSchema, schemaRepository); + fullSchema.Required.Remove(JsonApiPropertyName.Data); fullSchema.SetValuesInMetaToNullable(); diff --git a/src/JsonApiDotNetCore.OpenApi/UnusedComponentSchemaCleaner.cs b/src/JsonApiDotNetCore.OpenApi/UnusedComponentSchemaCleaner.cs new file mode 100644 index 0000000000..d7d9fa6ac7 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi/UnusedComponentSchemaCleaner.cs @@ -0,0 +1,60 @@ +using JetBrains.Annotations; +using Microsoft.OpenApi.Interfaces; +using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Services; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi; + +/// +/// Removes unreferenced component schemas from the OpenAPI document. +/// +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +internal sealed class UnusedComponentSchemaCleaner : IDocumentFilter +{ + public void Apply(OpenApiDocument document, DocumentFilterContext context) + { + var visitor = new OpenApiReferenceVisitor(); + var walker = new OpenApiWalker(visitor); + walker.Walk(document); + + HashSet unusedSchemaNames = []; + + foreach (string schemaId in document.Components.Schemas.Select(schema => schema.Key).Where(schemaId => !visitor.UsedSchemaNames.Contains(schemaId))) + { + unusedSchemaNames.Add(schemaId); + } + + foreach (string schemaId in unusedSchemaNames) + { + document.Components.Schemas.Remove(schemaId); + } + } + + private sealed class OpenApiReferenceVisitor : OpenApiVisitorBase + { + private const string ComponentSchemaPrefix = "#/components/schemas/"; + + public HashSet UsedSchemaNames { get; } = []; + + public override void Visit(IOpenApiReferenceable referenceable) + { + UsedSchemaNames.Add(referenceable.Reference.Id); + } + + public override void Visit(OpenApiSchema schema) + { + if (schema.Discriminator != null) + { + foreach (string discriminatorValue in schema.Discriminator.Mapping.Values) + { + if (discriminatorValue.StartsWith(ComponentSchemaPrefix, StringComparison.Ordinal)) + { + string schemaId = discriminatorValue[ComponentSchemaPrefix.Length..]; + UsedSchemaNames.Add(schemaId); + } + } + } + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorResponseDocument.cs index 44d6ad51be..3122165633 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorResponseDocument.cs @@ -27,14 +27,14 @@ public List Errors { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInErrorDocument? Links { - get { return BackingStore?.Get("links"); } + public ErrorTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInErrorDocument Links { - get { return BackingStore?.Get("links"); } + public ErrorTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -74,7 +74,7 @@ public static ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode pars public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"errors", n => { Errors = n.GetCollectionOfObjectValues(ErrorObject.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInErrorDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ErrorResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -85,7 +85,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("errors", Errors); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/LinksInErrorDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorTopLevelLinks.cs similarity index 89% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/LinksInErrorDocument.cs rename to test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorTopLevelLinks.cs index 235eace75f..45359db363 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/LinksInErrorDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { - public class LinksInErrorDocument : IBackedModel, IParsable { + public class ErrorTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInErrorDocument and sets the default values. + /// Instantiates a new errorTopLevelLinks and sets the default values. /// - public LinksInErrorDocument() { + public ErrorTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInErrorDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInErrorDocument(); + return new ErrorTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameDataInResponse.cs index f95436b302..76dd80a950 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameDataInResponse.cs @@ -23,14 +23,14 @@ public GameAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -62,7 +62,7 @@ public GameDataInResponse_meta Meta { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(GameAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(GameDataInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -74,7 +74,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GamePrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GamePrimaryResponseDocument.cs index 0e90abce17..6b2b89795a 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GamePrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GamePrimaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(Games.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(GamePrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/Games.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/Games.cs index 36b228b442..63486c2391 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/Games.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/Games.cs @@ -23,14 +23,14 @@ public GameAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -62,7 +62,7 @@ public Games_meta Meta { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(GameAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(Games_meta.CreateFromDiscriminatorValue); } }, }; } @@ -74,7 +74,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerDataInResponse.cs index bee3cc5a2c..6b33f8e65c 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerDataInResponse.cs @@ -23,14 +23,14 @@ public PlayerAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public PlayerRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(PlayerAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(PlayerDataInResponse_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(PlayerRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupDataInResponse.cs index e2d32ceff5..e0d4d766b7 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupDataInResponse.cs @@ -23,14 +23,14 @@ public PlayerGroupAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public PlayerGroupRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(PlayerGroupAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(PlayerGroupDataInResponse_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(PlayerGroupRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupPrimaryResponseDocument.cs index f5d3233277..d028fd680a 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupPrimaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(PlayerGroups.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(PlayerGroupPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroups.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroups.cs index 4dd61dc916..c5adce228d 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroups.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroups.cs @@ -23,14 +23,14 @@ public PlayerGroupAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public PlayerGroupRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(PlayerGroupAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(PlayerGroups_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(PlayerGroupRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerPrimaryResponseDocument.cs index 6c71def1fd..230951da0f 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerPrimaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(Players.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(PlayerPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/Players.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/Players.cs index ab0c37c8b0..f65d47e336 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/Players.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/Players.cs @@ -23,14 +23,14 @@ public PlayerAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public PlayerRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(PlayerAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(Players_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(PlayerRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/LinksInRelationship.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipLinks.cs similarity index 89% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/LinksInRelationship.cs rename to test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipLinks.cs index 31d80bed66..4a4315b979 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/LinksInRelationship.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { - public class LinksInRelationship : IBackedModel, IParsable { + public class RelationshipLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The related property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInRelationship and sets the default values. + /// Instantiates a new relationshipLinks and sets the default values. /// - public LinksInRelationship() { + public RelationshipLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInRelationship CreateFromDiscriminatorValue(IParseNode parseNode) { + public static RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInRelationship(); + return new RelationshipLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/LinksInResourceData.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceLinks.cs similarity index 86% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/LinksInResourceData.cs rename to test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceLinks.cs index cee8c101b9..272281a7ab 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/LinksInResourceData.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { - public class LinksInResourceData : IBackedModel, IParsable { + public class ResourceLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The self property @@ -24,18 +24,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceData and sets the default values. + /// Instantiates a new resourceLinks and sets the default values. /// - public LinksInResourceData() { + public ResourceLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceData CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceData(); + return new ResourceLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/LinksInResourceDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceTopLevelLinks.cs similarity index 88% rename from test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/LinksInResourceDocument.cs rename to test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceTopLevelLinks.cs index 168a7f98e1..744f1273d9 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/LinksInResourceDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models { - public class LinksInResourceDocument : IBackedModel, IParsable { + public class ResourceTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceDocument and sets the default values. + /// Instantiates a new resourceTopLevelLinks and sets the default values. /// - public LinksInResourceDocument() { + public ResourceTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceDocument(); + return new ResourceTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyGameInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyGameInResponse.cs index 8453e6bb4d..fe73cde720 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyGameInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyGameInResponse.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static ToManyGameInResponse CreateFromDiscriminatorValue(IParseNode parse public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(GameIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ToManyGameInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerGroupInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerGroupInResponse.cs index b5eae74093..3cb8fd1788 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerGroupInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerGroupInResponse.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static ToManyPlayerGroupInResponse CreateFromDiscriminatorValue(IParseNod public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(PlayerGroupIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ToManyPlayerGroupInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerInResponse.cs index b4d9d442ba..56eadd82f2 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerInResponse.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static ToManyPlayerInResponse CreateFromDiscriminatorValue(IParseNode par public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(PlayerIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ToManyPlayerInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/Countries.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/Countries.cs index 0e68d27801..df12085b87 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/Countries.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/Countries.cs @@ -23,14 +23,14 @@ public CountryAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public CountryRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(CountryAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(Countries_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(CountryRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryCollectionResponseDocument.cs index 0ca14d4253..fa560b51cd 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryCollectionResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(CountryDataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(CountryCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryDataInResponse.cs index 0091c947c5..81b264b111 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryDataInResponse.cs @@ -23,14 +23,14 @@ public CountryAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public CountryRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(CountryAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(CountryDataInResponse_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(CountryRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryPrimaryResponseDocument.cs index 7dd8c9b92a..b07b8165bc 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryPrimaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(Countries.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(CountryPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorResponseDocument.cs index 75b4e5a6bd..6c47da51ec 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorResponseDocument.cs @@ -27,14 +27,14 @@ public List Errors { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInErrorDocument? Links { - get { return BackingStore?.Get("links"); } + public ErrorTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInErrorDocument Links { - get { return BackingStore?.Get("links"); } + public ErrorTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -74,7 +74,7 @@ public static ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode pars public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"errors", n => { Errors = n.GetCollectionOfObjectValues(ErrorObject.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInErrorDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ErrorResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -85,7 +85,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("errors", Errors); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInErrorDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorTopLevelLinks.cs similarity index 89% rename from test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInErrorDocument.cs rename to test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorTopLevelLinks.cs index 46416586bd..c5ba5a8ae9 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInErrorDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { - public class LinksInErrorDocument : IBackedModel, IParsable { + public class ErrorTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInErrorDocument and sets the default values. + /// Instantiates a new errorTopLevelLinks and sets the default values. /// - public LinksInErrorDocument() { + public ErrorTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInErrorDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInErrorDocument(); + return new ErrorTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageCollectionResponseDocument.cs index b8a9e3faa4..57018d5dde 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageCollectionResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(LanguageDataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(LanguageCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageDataInResponse.cs index 1eae7d0ee3..934956586a 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageDataInResponse.cs @@ -23,14 +23,14 @@ public LanguageAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -62,7 +62,7 @@ public LanguageDataInResponse_meta Meta { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(LanguageAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(LanguageDataInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -74,7 +74,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierCollectionResponseDocument.cs index d7fed9b03a..fba435f473 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierCollectionResponseDocument.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceIdentifierCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceIdentifierCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static LanguageIdentifierCollectionResponseDocument CreateFromDiscriminat public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(LanguageIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceIdentifierCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(LanguageIdentifierCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInRelationship.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipLinks.cs similarity index 89% rename from test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInRelationship.cs rename to test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipLinks.cs index 348014877d..15761214de 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInRelationship.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { - public class LinksInRelationship : IBackedModel, IParsable { + public class RelationshipLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The related property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInRelationship and sets the default values. + /// Instantiates a new relationshipLinks and sets the default values. /// - public LinksInRelationship() { + public RelationshipLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInRelationship CreateFromDiscriminatorValue(IParseNode parseNode) { + public static RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInRelationship(); + return new RelationshipLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInResourceCollectionDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs similarity index 92% rename from test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInResourceCollectionDocument.cs rename to test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs index 0ce41d64e1..aa98e9f9e9 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInResourceCollectionDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { - public class LinksInResourceCollectionDocument : IBackedModel, IParsable { + public class ResourceCollectionTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -94,18 +94,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceCollectionDocument and sets the default values. + /// Instantiates a new resourceCollectionTopLevelLinks and sets the default values. /// - public LinksInResourceCollectionDocument() { + public ResourceCollectionTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceCollectionDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceCollectionDocument(); + return new ResourceCollectionTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInResourceIdentifierCollectionDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs similarity index 92% rename from test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInResourceIdentifierCollectionDocument.cs rename to test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs index 47b032073c..038939e2ee 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInResourceIdentifierCollectionDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { - public class LinksInResourceIdentifierCollectionDocument : IBackedModel, IParsable { + public class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -108,18 +108,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceIdentifierCollectionDocument and sets the default values. + /// Instantiates a new resourceIdentifierCollectionTopLevelLinks and sets the default values. /// - public LinksInResourceIdentifierCollectionDocument() { + public ResourceIdentifierCollectionTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceIdentifierCollectionDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceIdentifierCollectionDocument(); + return new ResourceIdentifierCollectionTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInResourceData.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceLinks.cs similarity index 86% rename from test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInResourceData.cs rename to test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceLinks.cs index 76aa642959..027b4628d8 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInResourceData.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { - public class LinksInResourceData : IBackedModel, IParsable { + public class ResourceLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The self property @@ -24,18 +24,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceData and sets the default values. + /// Instantiates a new resourceLinks and sets the default values. /// - public LinksInResourceData() { + public ResourceLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceData CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceData(); + return new ResourceLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInResourceDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceTopLevelLinks.cs similarity index 88% rename from test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInResourceDocument.cs rename to test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceTopLevelLinks.cs index d306b61e36..fafdf34c84 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LinksInResourceDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models { - public class LinksInResourceDocument : IBackedModel, IParsable { + public class ResourceTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceDocument and sets the default values. + /// Instantiates a new resourceTopLevelLinks and sets the default values. /// - public LinksInResourceDocument() { + public ResourceTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceDocument(); + return new ResourceTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ToManyLanguageInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ToManyLanguageInResponse.cs index ba1c9726ec..06051614c2 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ToManyLanguageInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ToManyLanguageInResponse.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static ToManyLanguageInResponse CreateFromDiscriminatorValue(IParseNode p public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(LanguageIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ToManyLanguageInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/AlternateOpenApiRouteTests.cs b/test/OpenApiKiotaEndToEndTests/Links/AlternateOpenApiRouteTests.cs new file mode 100644 index 0000000000..cbec1d0e5e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/AlternateOpenApiRouteTests.cs @@ -0,0 +1,55 @@ +using FluentAssertions; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.Links; +using Swashbuckle.AspNetCore.Swagger; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.Links; + +public sealed class AlternateOpenApiRouteTests : IClassFixture, LinkDbContext>> +{ + private readonly IntegrationTestContext, LinkDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly LinkFakers _fakers = new(); + + public AlternateOpenApiRouteTests(IntegrationTestContext, LinkDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.ConfigureServices(services => + services.Configure(options => options.RouteTemplate = "api-docs/{documentName}/swagger.yaml")); + + testContext.UseController(); + } + + [Fact] + public async Task DescribedBy_link_matches_alternate_OpenAPI_route() + { + // Arrange + Excursion excursion = _fakers.Excursion.Generate(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new LinksClient(requestAdapter); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Excursions.Add(excursion); + await dbContext.SaveChangesAsync(); + }); + + // Act + ExcursionPrimaryResponseDocument? response = await apiClient.Excursions[excursion.StringId].GetAsync(); + + // Assert + response.ShouldNotBeNull(); + response.Links.ShouldNotBeNull(); + response.Links.Describedby.Should().Be("api-docs/v1/swagger.yaml"); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/AccommodationsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/AccommodationsRequestBuilder.cs new file mode 100644 index 0000000000..cccada44f4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/AccommodationsRequestBuilder.cs @@ -0,0 +1,198 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations.Item; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations { + /// + /// Builds and executes requests for operations under \accommodations + /// + public class AccommodationsRequestBuilder : BaseRequestBuilder { + /// Gets an item from the OpenApiKiotaEndToEndTests.Links.GeneratedCode.accommodations.item collection + /// The identifier of the accommodation to retrieve. + public AccommodationsItemRequestBuilder this[string position] { get { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new AccommodationsItemRequestBuilder(urlTplParams, RequestAdapter); + } } + /// + /// Instantiates a new AccommodationsRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AccommodationsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/accommodations{?query*}", pathParameters) { + } + /// + /// Instantiates a new AccommodationsRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AccommodationsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/accommodations{?query*}", rawUrl) { + } + /// + /// Retrieves a collection of accommodations. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, AccommodationCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task HeadAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToHeadRequestInformation(requestConfiguration); + return await RequestAdapter.SendPrimitiveAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Creates a new accommodation. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task PostAsync(AccommodationPostRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task PostAsync(AccommodationPostRequestDocument body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"403", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"409", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"422", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, AccommodationPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Retrieves a collection of accommodations. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToHeadRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + /// + /// Creates a new accommodation. + /// + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToPostRequestInformation(AccommodationPostRequestDocument body, Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToPostRequestInformation(AccommodationPostRequestDocument body, Action> requestConfiguration = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// The raw URL to use for the request builder. + public AccommodationsRequestBuilder WithUrl(string rawUrl) { + return new AccommodationsRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Retrieves a collection of accommodations. + /// + public class AccommodationsRequestBuilderGetQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + public class AccommodationsRequestBuilderHeadQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Creates a new accommodation. + /// + public class AccommodationsRequestBuilderPostQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/Item/AccommodationsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/Item/AccommodationsItemRequestBuilder.cs new file mode 100644 index 0000000000..fb62be82fd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/Item/AccommodationsItemRequestBuilder.cs @@ -0,0 +1,224 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations.Item { + /// + /// Builds and executes requests for operations under \accommodations\{id} + /// + public class AccommodationsItemRequestBuilder : BaseRequestBuilder { + /// + /// Instantiates a new AccommodationsItemRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AccommodationsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/accommodations/{id}{?query*}", pathParameters) { + } + /// + /// Instantiates a new AccommodationsItemRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AccommodationsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/accommodations/{id}{?query*}", rawUrl) { + } + /// + /// Deletes an existing accommodation by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task DeleteAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Retrieves an individual accommodation by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, AccommodationPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task HeadAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToHeadRequestInformation(requestConfiguration); + return await RequestAdapter.SendPrimitiveAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Updates an existing accommodation. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task PatchAsync(AccommodationPatchRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task PatchAsync(AccommodationPatchRequestDocument body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"409", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"422", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, AccommodationPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Deletes an existing accommodation by its identifier. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToDeleteRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Retrieves an individual accommodation by its identifier. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToHeadRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + /// + /// Updates an existing accommodation. + /// + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToPatchRequestInformation(AccommodationPatchRequestDocument body, Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToPatchRequestInformation(AccommodationPatchRequestDocument body, Action> requestConfiguration = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// The raw URL to use for the request builder. + public AccommodationsItemRequestBuilder WithUrl(string rawUrl) { + return new AccommodationsItemRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Retrieves an individual accommodation by its identifier. + /// + public class AccommodationsItemRequestBuilderGetQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + public class AccommodationsItemRequestBuilderHeadQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Updates an existing accommodation. + /// + public class AccommodationsItemRequestBuilderPatchQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Excursions/ExcursionsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Excursions/ExcursionsRequestBuilder.cs new file mode 100644 index 0000000000..76807747a0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Excursions/ExcursionsRequestBuilder.cs @@ -0,0 +1,198 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions.Item; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions { + /// + /// Builds and executes requests for operations under \excursions + /// + public class ExcursionsRequestBuilder : BaseRequestBuilder { + /// Gets an item from the OpenApiKiotaEndToEndTests.Links.GeneratedCode.excursions.item collection + /// The identifier of the excursion to retrieve. + public ExcursionsItemRequestBuilder this[string position] { get { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new ExcursionsItemRequestBuilder(urlTplParams, RequestAdapter); + } } + /// + /// Instantiates a new ExcursionsRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ExcursionsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/excursions{?query*}", pathParameters) { + } + /// + /// Instantiates a new ExcursionsRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ExcursionsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/excursions{?query*}", rawUrl) { + } + /// + /// Retrieves a collection of excursions. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, ExcursionCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task HeadAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToHeadRequestInformation(requestConfiguration); + return await RequestAdapter.SendPrimitiveAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Creates a new excursion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task PostAsync(ExcursionPostRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task PostAsync(ExcursionPostRequestDocument body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"403", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"409", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"422", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, ExcursionPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Retrieves a collection of excursions. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToHeadRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + /// + /// Creates a new excursion. + /// + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToPostRequestInformation(ExcursionPostRequestDocument body, Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToPostRequestInformation(ExcursionPostRequestDocument body, Action> requestConfiguration = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// The raw URL to use for the request builder. + public ExcursionsRequestBuilder WithUrl(string rawUrl) { + return new ExcursionsRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Retrieves a collection of excursions. + /// + public class ExcursionsRequestBuilderGetQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + public class ExcursionsRequestBuilderHeadQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Creates a new excursion. + /// + public class ExcursionsRequestBuilderPostQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Excursions/Item/ExcursionsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Excursions/Item/ExcursionsItemRequestBuilder.cs new file mode 100644 index 0000000000..251819987a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Excursions/Item/ExcursionsItemRequestBuilder.cs @@ -0,0 +1,224 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions.Item { + /// + /// Builds and executes requests for operations under \excursions\{id} + /// + public class ExcursionsItemRequestBuilder : BaseRequestBuilder { + /// + /// Instantiates a new ExcursionsItemRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ExcursionsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/excursions/{id}{?query*}", pathParameters) { + } + /// + /// Instantiates a new ExcursionsItemRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ExcursionsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/excursions/{id}{?query*}", rawUrl) { + } + /// + /// Deletes an existing excursion by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task DeleteAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Retrieves an individual excursion by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, ExcursionPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task HeadAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToHeadRequestInformation(requestConfiguration); + return await RequestAdapter.SendPrimitiveAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Updates an existing excursion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task PatchAsync(ExcursionPatchRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task PatchAsync(ExcursionPatchRequestDocument body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"409", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"422", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, ExcursionPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Deletes an existing excursion by its identifier. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToDeleteRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Retrieves an individual excursion by its identifier. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToHeadRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + /// + /// Updates an existing excursion. + /// + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToPatchRequestInformation(ExcursionPatchRequestDocument body, Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToPatchRequestInformation(ExcursionPatchRequestDocument body, Action> requestConfiguration = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// The raw URL to use for the request builder. + public ExcursionsItemRequestBuilder WithUrl(string rawUrl) { + return new ExcursionsItemRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Retrieves an individual excursion by its identifier. + /// + public class ExcursionsItemRequestBuilderGetQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + public class ExcursionsItemRequestBuilderHeadQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Updates an existing excursion. + /// + public class ExcursionsItemRequestBuilderPatchQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/LinksClient.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/LinksClient.cs new file mode 100644 index 0000000000..c777e7c010 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/LinksClient.cs @@ -0,0 +1,59 @@ +// +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode { + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + public class LinksClient : BaseRequestBuilder { + /// The accommodations property + public AccommodationsRequestBuilder Accommodations { get => + new AccommodationsRequestBuilder(PathParameters, RequestAdapter); + } + /// The excursions property + public ExcursionsRequestBuilder Excursions { get => + new ExcursionsRequestBuilder(PathParameters, RequestAdapter); + } + /// The transports property + public TransportsRequestBuilder Transports { get => + new TransportsRequestBuilder(PathParameters, RequestAdapter); + } + /// The vacations property + public VacationsRequestBuilder Vacations { get => + new VacationsRequestBuilder(PathParameters, RequestAdapter); + } + /// + /// Instantiates a new LinksClient and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public LinksClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Accommodation.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Accommodation.cs new file mode 100644 index 0000000000..b093fe6066 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Accommodation.cs @@ -0,0 +1,81 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class Accommodation : DataInResponse, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationAttributesInResponse? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public AccommodationAttributesInResponse Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public Accommodation_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public Accommodation_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static new Accommodation CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new Accommodation(); + } + /// + /// The deserialization information for the current model + /// + public override IDictionary> GetFieldDeserializers() { + return new Dictionary>(base.GetFieldDeserializers()) { + {"attributes", n => { Attributes = n.GetObjectValue(AccommodationAttributesInResponse.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(Accommodation_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationAttributesInPatchRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationAttributesInPatchRequest.cs new file mode 100644 index 0000000000..edb9f2517f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationAttributesInPatchRequest.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationAttributesInPatchRequest : IBackedModel, IParsable { + /// The address property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Address { + get { return BackingStore?.Get("address"); } + set { BackingStore?.Set("address", value); } + } +#nullable restore +#else + public string Address { + get { return BackingStore?.Get("address"); } + set { BackingStore?.Set("address", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new accommodationAttributesInPatchRequest and sets the default values. + /// + public AccommodationAttributesInPatchRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationAttributesInPatchRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationAttributesInPatchRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"address", n => { Address = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("address", Address); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationAttributesInPostRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationAttributesInPostRequest.cs new file mode 100644 index 0000000000..9f73931045 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationAttributesInPostRequest.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationAttributesInPostRequest : IBackedModel, IParsable { + /// The address property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Address { + get { return BackingStore?.Get("address"); } + set { BackingStore?.Set("address", value); } + } +#nullable restore +#else + public string Address { + get { return BackingStore?.Get("address"); } + set { BackingStore?.Set("address", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new accommodationAttributesInPostRequest and sets the default values. + /// + public AccommodationAttributesInPostRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationAttributesInPostRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationAttributesInPostRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"address", n => { Address = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("address", Address); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationAttributesInResponse.cs new file mode 100644 index 0000000000..eab97adf78 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationAttributesInResponse.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationAttributesInResponse : IBackedModel, IParsable { + /// The address property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Address { + get { return BackingStore?.Get("address"); } + set { BackingStore?.Set("address", value); } + } +#nullable restore +#else + public string Address { + get { return BackingStore?.Get("address"); } + set { BackingStore?.Set("address", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new accommodationAttributesInResponse and sets the default values. + /// + public AccommodationAttributesInResponse() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationAttributesInResponse(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"address", n => { Address = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("address", Address); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationCollectionResponseDocument.cs new file mode 100644 index 0000000000..6b9a8f0405 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationCollectionResponseDocument.cs @@ -0,0 +1,105 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationCollectionResponseDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Data { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public List Data { + get { return BackingStore?.Get>("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The included property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Included { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } +#nullable restore +#else + public List Included { + get { return BackingStore?.Get>("included"); } + set { BackingStore?.Set("included", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationCollectionResponseDocument_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public AccommodationCollectionResponseDocument_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new accommodationCollectionResponseDocument and sets the default values. + /// + public AccommodationCollectionResponseDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationCollectionResponseDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetCollectionOfObjectValues(AccommodationDataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, + {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, + {"links", n => { Links = n.GetObjectValue(ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(AccommodationCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationCollectionResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationCollectionResponseDocument_meta.cs new file mode 100644 index 0000000000..a0a54bf3a0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationCollectionResponseDocument_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationCollectionResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new accommodationCollectionResponseDocument_meta and sets the default values. + /// + public AccommodationCollectionResponseDocument_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationCollectionResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationCollectionResponseDocument_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInPatchRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInPatchRequest.cs new file mode 100644 index 0000000000..f628f6f04b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInPatchRequest.cs @@ -0,0 +1,80 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationDataInPatchRequest : IBackedModel, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationAttributesInPatchRequest? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public AccommodationAttributesInPatchRequest Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#nullable restore +#else + public string Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#endif + /// The type property + public AccommodationResourceType? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + /// + /// Instantiates a new accommodationDataInPatchRequest and sets the default values. + /// + public AccommodationDataInPatchRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationDataInPatchRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationDataInPatchRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"attributes", n => { Attributes = n.GetObjectValue(AccommodationAttributesInPatchRequest.CreateFromDiscriminatorValue); } }, + {"id", n => { Id = n.GetStringValue(); } }, + {"type", n => { Type = n.GetEnumValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteEnumValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInPostRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInPostRequest.cs new file mode 100644 index 0000000000..0aec47d664 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInPostRequest.cs @@ -0,0 +1,64 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationDataInPostRequest : IBackedModel, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationAttributesInPostRequest? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public AccommodationAttributesInPostRequest Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The type property + public AccommodationResourceType? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + /// + /// Instantiates a new accommodationDataInPostRequest and sets the default values. + /// + public AccommodationDataInPostRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationDataInPostRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationDataInPostRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"attributes", n => { Attributes = n.GetObjectValue(AccommodationAttributesInPostRequest.CreateFromDiscriminatorValue); } }, + {"type", n => { Type = n.GetEnumValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteEnumValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInResponse.cs new file mode 100644 index 0000000000..11924fc0db --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInResponse.cs @@ -0,0 +1,81 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationDataInResponse : DataInResponse, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationAttributesInResponse? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public AccommodationAttributesInResponse Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationDataInResponse_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public AccommodationDataInResponse_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static new AccommodationDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationDataInResponse(); + } + /// + /// The deserialization information for the current model + /// + public override IDictionary> GetFieldDeserializers() { + return new Dictionary>(base.GetFieldDeserializers()) { + {"attributes", n => { Attributes = n.GetObjectValue(AccommodationAttributesInResponse.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(AccommodationDataInResponse_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInResponse_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInResponse_meta.cs new file mode 100644 index 0000000000..03324bd434 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInResponse_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationDataInResponse_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new accommodationDataInResponse_meta and sets the default values. + /// + public AccommodationDataInResponse_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationDataInResponse_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationDataInResponse_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifier.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifier.cs new file mode 100644 index 0000000000..68140972cd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifier.cs @@ -0,0 +1,64 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationIdentifier : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#nullable restore +#else + public string Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#endif + /// The type property + public AccommodationResourceType? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + /// + /// Instantiates a new accommodationIdentifier and sets the default values. + /// + public AccommodationIdentifier() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationIdentifier(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"id", n => { Id = n.GetStringValue(); } }, + {"type", n => { Type = n.GetEnumValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteEnumValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierResponseDocument.cs new file mode 100644 index 0000000000..710faa2f4b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierResponseDocument.cs @@ -0,0 +1,89 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationIdentifierResponseDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationIdentifier? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public AccommodationIdentifier Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceIdentifierTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceIdentifierTopLevelLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationIdentifierResponseDocument_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public AccommodationIdentifierResponseDocument_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new accommodationIdentifierResponseDocument and sets the default values. + /// + public AccommodationIdentifierResponseDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationIdentifierResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationIdentifierResponseDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(AccommodationIdentifier.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(AccommodationIdentifierResponseDocument_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierResponseDocument_meta.cs new file mode 100644 index 0000000000..ffd0db6455 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierResponseDocument_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationIdentifierResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new accommodationIdentifierResponseDocument_meta and sets the default values. + /// + public AccommodationIdentifierResponseDocument_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationIdentifierResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationIdentifierResponseDocument_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPatchRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPatchRequestDocument.cs new file mode 100644 index 0000000000..5ce53ec749 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPatchRequestDocument.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationPatchRequestDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationDataInPatchRequest? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public AccommodationDataInPatchRequest Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// + /// Instantiates a new accommodationPatchRequestDocument and sets the default values. + /// + public AccommodationPatchRequestDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationPatchRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationPatchRequestDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(AccommodationDataInPatchRequest.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPostRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPostRequestDocument.cs new file mode 100644 index 0000000000..5a2e24705d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPostRequestDocument.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationPostRequestDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationDataInPostRequest? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public AccommodationDataInPostRequest Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// + /// Instantiates a new accommodationPostRequestDocument and sets the default values. + /// + public AccommodationPostRequestDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationPostRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationPostRequestDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(AccommodationDataInPostRequest.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPrimaryResponseDocument.cs new file mode 100644 index 0000000000..93f4486eba --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPrimaryResponseDocument.cs @@ -0,0 +1,105 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationPrimaryResponseDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public Accommodations? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public Accommodations Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The included property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Included { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } +#nullable restore +#else + public List Included { + get { return BackingStore?.Get>("included"); } + set { BackingStore?.Set("included", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationPrimaryResponseDocument_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public AccommodationPrimaryResponseDocument_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new accommodationPrimaryResponseDocument and sets the default values. + /// + public AccommodationPrimaryResponseDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationPrimaryResponseDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(Accommodations.CreateFromDiscriminatorValue); } }, + {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(AccommodationPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPrimaryResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPrimaryResponseDocument_meta.cs new file mode 100644 index 0000000000..2db2ca95bc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationPrimaryResponseDocument_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationPrimaryResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new accommodationPrimaryResponseDocument_meta and sets the default values. + /// + public AccommodationPrimaryResponseDocument_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationPrimaryResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationPrimaryResponseDocument_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationResourceType.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationResourceType.cs new file mode 100644 index 0000000000..597bd7ba63 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationResourceType.cs @@ -0,0 +1,9 @@ +// +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public enum AccommodationResourceType { + [EnumMember(Value = "accommodations")] + Accommodations, + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationSecondaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationSecondaryResponseDocument.cs new file mode 100644 index 0000000000..a0b1d5884a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationSecondaryResponseDocument.cs @@ -0,0 +1,105 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationSecondaryResponseDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public Accommodation? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public Accommodation Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The included property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Included { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } +#nullable restore +#else + public List Included { + get { return BackingStore?.Get>("included"); } + set { BackingStore?.Set("included", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationSecondaryResponseDocument_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public AccommodationSecondaryResponseDocument_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new accommodationSecondaryResponseDocument and sets the default values. + /// + public AccommodationSecondaryResponseDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationSecondaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationSecondaryResponseDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(Accommodation.CreateFromDiscriminatorValue); } }, + {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(AccommodationSecondaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationSecondaryResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationSecondaryResponseDocument_meta.cs new file mode 100644 index 0000000000..6e8fd51ac2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationSecondaryResponseDocument_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class AccommodationSecondaryResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new accommodationSecondaryResponseDocument_meta and sets the default values. + /// + public AccommodationSecondaryResponseDocument_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static AccommodationSecondaryResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new AccommodationSecondaryResponseDocument_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Accommodation_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Accommodation_meta.cs new file mode 100644 index 0000000000..b77cd20b74 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Accommodation_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class Accommodation_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new accommodation_meta and sets the default values. + /// + public Accommodation_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static Accommodation_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new Accommodation_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Accommodations.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Accommodations.cs new file mode 100644 index 0000000000..c05bba2138 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Accommodations.cs @@ -0,0 +1,81 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class Accommodations : DataInResponse, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationAttributesInResponse? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public AccommodationAttributesInResponse Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public Accommodations_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public Accommodations_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static new Accommodations CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new Accommodations(); + } + /// + /// The deserialization information for the current model + /// + public override IDictionary> GetFieldDeserializers() { + return new Dictionary>(base.GetFieldDeserializers()) { + {"attributes", n => { Attributes = n.GetObjectValue(AccommodationAttributesInResponse.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(Accommodations_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Accommodations_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Accommodations_meta.cs new file mode 100644 index 0000000000..ead4056dfb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Accommodations_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class Accommodations_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new accommodations_meta and sets the default values. + /// + public Accommodations_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static Accommodations_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new Accommodations_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInResponse.cs new file mode 100644 index 0000000000..ab2427f6ad --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInResponse.cs @@ -0,0 +1,80 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class DataInResponse : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#nullable restore +#else + public string Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#endif + /// The type property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } +#nullable restore +#else + public string Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } +#endif + /// + /// Instantiates a new dataInResponse and sets the default values. + /// + public DataInResponse() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static DataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch { + "accommodations" => new AccommodationDataInResponse(), + "excursions" => new ExcursionDataInResponse(), + "transports" => new TransportDataInResponse(), + "vacations" => new VacationDataInResponse(), + _ => new DataInResponse(), + }; + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"id", n => { Id = n.GetStringValue(); } }, + {"type", n => { Type = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..8f1352ba48 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,73 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ErrorLinks : IBackedModel, IParsable { + /// The about property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? About { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } +#nullable restore +#else + public string About { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The type property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } +#nullable restore +#else + public string Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } +#endif + /// + /// Instantiates a new errorLinks and sets the default values. + /// + public ErrorLinks() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ErrorLinks(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"about", n => { About = n.GetStringValue(); } }, + {"type", n => { Type = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..9ab92df644 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,169 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ErrorObject : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The code property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Code { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } +#nullable restore +#else + public string Code { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } +#endif + /// The detail property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Detail { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } +#nullable restore +#else + public string Detail { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } +#endif + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#nullable restore +#else + public string Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ErrorLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ErrorLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ErrorObject_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public ErrorObject_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// The source property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ErrorSource? Source { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } +#nullable restore +#else + public ErrorSource Source { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } +#endif + /// The status property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Status { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } +#nullable restore +#else + public string Status { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } +#endif + /// The title property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Title { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } +#nullable restore +#else + public string Title { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } +#endif + /// + /// Instantiates a new errorObject and sets the default values. + /// + public ErrorObject() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ErrorObject(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"code", n => { Code = n.GetStringValue(); } }, + {"detail", n => { Detail = n.GetStringValue(); } }, + {"id", n => { Id = n.GetStringValue(); } }, + {"links", n => { Links = n.GetObjectValue(ErrorLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(ErrorObject_meta.CreateFromDiscriminatorValue); } }, + {"source", n => { Source = n.GetObjectValue(ErrorSource.CreateFromDiscriminatorValue); } }, + {"status", n => { Status = n.GetStringValue(); } }, + {"title", n => { Title = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorObject_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorObject_meta.cs new file mode 100644 index 0000000000..89881fad3d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorObject_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ErrorObject_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new errorObject_meta and sets the default values. + /// + public ErrorObject_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ErrorObject_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ErrorObject_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..895a566e04 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ErrorResponseDocument : ApiException, IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The errors property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Errors { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } +#nullable restore +#else + public List Errors { + get { return BackingStore?.Get>("errors"); } + set { BackingStore?.Set("errors", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ErrorTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ErrorTopLevelLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The primary error message. + public override string Message { get => base.Message; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ErrorResponseDocument_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public ErrorResponseDocument_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new errorResponseDocument and sets the default values. + /// + public ErrorResponseDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ErrorResponseDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"errors", n => { Errors = n.GetCollectionOfObjectValues(ErrorObject.CreateFromDiscriminatorValue)?.ToList(); } }, + {"links", n => { Links = n.GetObjectValue(ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(ErrorResponseDocument_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorResponseDocument_meta.cs new file mode 100644 index 0000000000..4e3daf54fd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorResponseDocument_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ErrorResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new errorResponseDocument_meta and sets the default values. + /// + public ErrorResponseDocument_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ErrorResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ErrorResponseDocument_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..af65403fed --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,89 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ErrorSource : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The header property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Header { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } +#nullable restore +#else + public string Header { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } +#endif + /// The parameter property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Parameter { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } +#nullable restore +#else + public string Parameter { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } +#endif + /// The pointer property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Pointer { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } +#nullable restore +#else + public string Pointer { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } +#endif + /// + /// Instantiates a new errorSource and sets the default values. + /// + public ErrorSource() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ErrorSource(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"header", n => { Header = n.GetStringValue(); } }, + {"parameter", n => { Parameter = n.GetStringValue(); } }, + {"pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..db4a9312a8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,73 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ErrorTopLevelLinks : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The describedby property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Describedby { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } +#nullable restore +#else + public string Describedby { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } +#endif + /// The self property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Self { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } +#nullable restore +#else + public string Self { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } +#endif + /// + /// Instantiates a new errorTopLevelLinks and sets the default values. + /// + public ErrorTopLevelLinks() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ErrorTopLevelLinks(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"describedby", n => { Describedby = n.GetStringValue(); } }, + {"self", n => { Self = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionAttributesInPatchRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionAttributesInPatchRequest.cs new file mode 100644 index 0000000000..9ceae377cc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionAttributesInPatchRequest.cs @@ -0,0 +1,64 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionAttributesInPatchRequest : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The description property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Description { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } +#nullable restore +#else + public string Description { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } +#endif + /// The occursAt property + public DateTimeOffset? OccursAt { + get { return BackingStore?.Get("occursAt"); } + set { BackingStore?.Set("occursAt", value); } + } + /// + /// Instantiates a new excursionAttributesInPatchRequest and sets the default values. + /// + public ExcursionAttributesInPatchRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionAttributesInPatchRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionAttributesInPatchRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"description", n => { Description = n.GetStringValue(); } }, + {"occursAt", n => { OccursAt = n.GetDateTimeOffsetValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("description", Description); + writer.WriteDateTimeOffsetValue("occursAt", OccursAt); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionAttributesInPostRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionAttributesInPostRequest.cs new file mode 100644 index 0000000000..b123ce1980 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionAttributesInPostRequest.cs @@ -0,0 +1,64 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionAttributesInPostRequest : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The description property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Description { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } +#nullable restore +#else + public string Description { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } +#endif + /// The occursAt property + public DateTimeOffset? OccursAt { + get { return BackingStore?.Get("occursAt"); } + set { BackingStore?.Set("occursAt", value); } + } + /// + /// Instantiates a new excursionAttributesInPostRequest and sets the default values. + /// + public ExcursionAttributesInPostRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionAttributesInPostRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionAttributesInPostRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"description", n => { Description = n.GetStringValue(); } }, + {"occursAt", n => { OccursAt = n.GetDateTimeOffsetValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("description", Description); + writer.WriteDateTimeOffsetValue("occursAt", OccursAt); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionAttributesInResponse.cs new file mode 100644 index 0000000000..c83ffc045c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionAttributesInResponse.cs @@ -0,0 +1,64 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionAttributesInResponse : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The description property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Description { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } +#nullable restore +#else + public string Description { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } +#endif + /// The occursAt property + public DateTimeOffset? OccursAt { + get { return BackingStore?.Get("occursAt"); } + set { BackingStore?.Set("occursAt", value); } + } + /// + /// Instantiates a new excursionAttributesInResponse and sets the default values. + /// + public ExcursionAttributesInResponse() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionAttributesInResponse(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"description", n => { Description = n.GetStringValue(); } }, + {"occursAt", n => { OccursAt = n.GetDateTimeOffsetValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("description", Description); + writer.WriteDateTimeOffsetValue("occursAt", OccursAt); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionCollectionResponseDocument.cs new file mode 100644 index 0000000000..98d5da90be --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionCollectionResponseDocument.cs @@ -0,0 +1,105 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionCollectionResponseDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Data { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public List Data { + get { return BackingStore?.Get>("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The included property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Included { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } +#nullable restore +#else + public List Included { + get { return BackingStore?.Get>("included"); } + set { BackingStore?.Set("included", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ExcursionCollectionResponseDocument_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public ExcursionCollectionResponseDocument_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new excursionCollectionResponseDocument and sets the default values. + /// + public ExcursionCollectionResponseDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionCollectionResponseDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetCollectionOfObjectValues(ExcursionDataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, + {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, + {"links", n => { Links = n.GetObjectValue(ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(ExcursionCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionCollectionResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionCollectionResponseDocument_meta.cs new file mode 100644 index 0000000000..fc6813ab87 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionCollectionResponseDocument_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionCollectionResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new excursionCollectionResponseDocument_meta and sets the default values. + /// + public ExcursionCollectionResponseDocument_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionCollectionResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionCollectionResponseDocument_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInPatchRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInPatchRequest.cs new file mode 100644 index 0000000000..ea0a559ceb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInPatchRequest.cs @@ -0,0 +1,80 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionDataInPatchRequest : IBackedModel, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ExcursionAttributesInPatchRequest? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public ExcursionAttributesInPatchRequest Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#nullable restore +#else + public string Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#endif + /// The type property + public ExcursionResourceType? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + /// + /// Instantiates a new excursionDataInPatchRequest and sets the default values. + /// + public ExcursionDataInPatchRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionDataInPatchRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionDataInPatchRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"attributes", n => { Attributes = n.GetObjectValue(ExcursionAttributesInPatchRequest.CreateFromDiscriminatorValue); } }, + {"id", n => { Id = n.GetStringValue(); } }, + {"type", n => { Type = n.GetEnumValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteEnumValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInPostRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInPostRequest.cs new file mode 100644 index 0000000000..ebd58f4152 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInPostRequest.cs @@ -0,0 +1,64 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionDataInPostRequest : IBackedModel, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ExcursionAttributesInPostRequest? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public ExcursionAttributesInPostRequest Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The type property + public ExcursionResourceType? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + /// + /// Instantiates a new excursionDataInPostRequest and sets the default values. + /// + public ExcursionDataInPostRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionDataInPostRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionDataInPostRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"attributes", n => { Attributes = n.GetObjectValue(ExcursionAttributesInPostRequest.CreateFromDiscriminatorValue); } }, + {"type", n => { Type = n.GetEnumValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteEnumValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInResponse.cs new file mode 100644 index 0000000000..16cf1d7767 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInResponse.cs @@ -0,0 +1,81 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionDataInResponse : DataInResponse, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ExcursionAttributesInResponse? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public ExcursionAttributesInResponse Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ExcursionDataInResponse_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public ExcursionDataInResponse_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static new ExcursionDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionDataInResponse(); + } + /// + /// The deserialization information for the current model + /// + public override IDictionary> GetFieldDeserializers() { + return new Dictionary>(base.GetFieldDeserializers()) { + {"attributes", n => { Attributes = n.GetObjectValue(ExcursionAttributesInResponse.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(ExcursionDataInResponse_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInResponse_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInResponse_meta.cs new file mode 100644 index 0000000000..42f8b840e4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInResponse_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionDataInResponse_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new excursionDataInResponse_meta and sets the default values. + /// + public ExcursionDataInResponse_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionDataInResponse_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionDataInResponse_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifier.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifier.cs new file mode 100644 index 0000000000..722c7d3cdc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifier.cs @@ -0,0 +1,64 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionIdentifier : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#nullable restore +#else + public string Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#endif + /// The type property + public ExcursionResourceType? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + /// + /// Instantiates a new excursionIdentifier and sets the default values. + /// + public ExcursionIdentifier() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionIdentifier(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"id", n => { Id = n.GetStringValue(); } }, + {"type", n => { Type = n.GetEnumValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteEnumValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..8675fc22c7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierCollectionResponseDocument.cs @@ -0,0 +1,89 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionIdentifierCollectionResponseDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Data { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public List Data { + get { return BackingStore?.Get>("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceIdentifierCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceIdentifierCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ExcursionIdentifierCollectionResponseDocument_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public ExcursionIdentifierCollectionResponseDocument_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new excursionIdentifierCollectionResponseDocument and sets the default values. + /// + public ExcursionIdentifierCollectionResponseDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionIdentifierCollectionResponseDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetCollectionOfObjectValues(ExcursionIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(ExcursionIdentifierCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierCollectionResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierCollectionResponseDocument_meta.cs new file mode 100644 index 0000000000..04e79cb8d2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierCollectionResponseDocument_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionIdentifierCollectionResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new excursionIdentifierCollectionResponseDocument_meta and sets the default values. + /// + public ExcursionIdentifierCollectionResponseDocument_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionIdentifierCollectionResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionIdentifierCollectionResponseDocument_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPatchRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPatchRequestDocument.cs new file mode 100644 index 0000000000..3e2ab3e62a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPatchRequestDocument.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionPatchRequestDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ExcursionDataInPatchRequest? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public ExcursionDataInPatchRequest Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// + /// Instantiates a new excursionPatchRequestDocument and sets the default values. + /// + public ExcursionPatchRequestDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionPatchRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionPatchRequestDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(ExcursionDataInPatchRequest.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPostRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPostRequestDocument.cs new file mode 100644 index 0000000000..ee60f611e4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPostRequestDocument.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionPostRequestDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ExcursionDataInPostRequest? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public ExcursionDataInPostRequest Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// + /// Instantiates a new excursionPostRequestDocument and sets the default values. + /// + public ExcursionPostRequestDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionPostRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionPostRequestDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(ExcursionDataInPostRequest.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPrimaryResponseDocument.cs new file mode 100644 index 0000000000..6055426365 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPrimaryResponseDocument.cs @@ -0,0 +1,105 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionPrimaryResponseDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public Excursions? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public Excursions Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The included property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Included { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } +#nullable restore +#else + public List Included { + get { return BackingStore?.Get>("included"); } + set { BackingStore?.Set("included", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ExcursionPrimaryResponseDocument_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public ExcursionPrimaryResponseDocument_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new excursionPrimaryResponseDocument and sets the default values. + /// + public ExcursionPrimaryResponseDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionPrimaryResponseDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(Excursions.CreateFromDiscriminatorValue); } }, + {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(ExcursionPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPrimaryResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPrimaryResponseDocument_meta.cs new file mode 100644 index 0000000000..f2fd9cfa00 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionPrimaryResponseDocument_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ExcursionPrimaryResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new excursionPrimaryResponseDocument_meta and sets the default values. + /// + public ExcursionPrimaryResponseDocument_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ExcursionPrimaryResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ExcursionPrimaryResponseDocument_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionResourceType.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionResourceType.cs new file mode 100644 index 0000000000..3b8446d954 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionResourceType.cs @@ -0,0 +1,9 @@ +// +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public enum ExcursionResourceType { + [EnumMember(Value = "excursions")] + Excursions, + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Excursions.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Excursions.cs new file mode 100644 index 0000000000..5e874fae59 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Excursions.cs @@ -0,0 +1,81 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class Excursions : DataInResponse, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ExcursionAttributesInResponse? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public ExcursionAttributesInResponse Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public Excursions_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public Excursions_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static new Excursions CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new Excursions(); + } + /// + /// The deserialization information for the current model + /// + public override IDictionary> GetFieldDeserializers() { + return new Dictionary>(base.GetFieldDeserializers()) { + {"attributes", n => { Attributes = n.GetObjectValue(ExcursionAttributesInResponse.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(Excursions_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Excursions_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Excursions_meta.cs new file mode 100644 index 0000000000..a6fd9ae9d9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Excursions_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class Excursions_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new excursions_meta and sets the default values. + /// + public Excursions_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static Excursions_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new Excursions_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInRequest.cs new file mode 100644 index 0000000000..7b74e21750 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInRequest.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class NullableToOneTransportInRequest : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public TransportIdentifier? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public TransportIdentifier Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// + /// Instantiates a new nullableToOneTransportInRequest and sets the default values. + /// + public NullableToOneTransportInRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static NullableToOneTransportInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new NullableToOneTransportInRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(TransportIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInResponse.cs new file mode 100644 index 0000000000..537dddd78d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInResponse.cs @@ -0,0 +1,89 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class NullableToOneTransportInResponse : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public TransportIdentifier? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public TransportIdentifier Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public NullableToOneTransportInResponse_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public NullableToOneTransportInResponse_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new nullableToOneTransportInResponse and sets the default values. + /// + public NullableToOneTransportInResponse() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static NullableToOneTransportInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new NullableToOneTransportInResponse(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(TransportIdentifier.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(NullableToOneTransportInResponse_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInResponse_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInResponse_meta.cs new file mode 100644 index 0000000000..da4d9d0a7d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInResponse_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class NullableToOneTransportInResponse_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new nullableToOneTransportInResponse_meta and sets the default values. + /// + public NullableToOneTransportInResponse_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static NullableToOneTransportInResponse_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new NullableToOneTransportInResponse_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportIdentifierResponseDocument.cs new file mode 100644 index 0000000000..05f0cc5c1e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportIdentifierResponseDocument.cs @@ -0,0 +1,89 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class NullableTransportIdentifierResponseDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public TransportIdentifier? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public TransportIdentifier Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceIdentifierTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceIdentifierTopLevelLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public NullableTransportIdentifierResponseDocument_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public NullableTransportIdentifierResponseDocument_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new nullableTransportIdentifierResponseDocument and sets the default values. + /// + public NullableTransportIdentifierResponseDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static NullableTransportIdentifierResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new NullableTransportIdentifierResponseDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(TransportIdentifier.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(NullableTransportIdentifierResponseDocument_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportIdentifierResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportIdentifierResponseDocument_meta.cs new file mode 100644 index 0000000000..f8aec372c3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportIdentifierResponseDocument_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class NullableTransportIdentifierResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new nullableTransportIdentifierResponseDocument_meta and sets the default values. + /// + public NullableTransportIdentifierResponseDocument_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static NullableTransportIdentifierResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new NullableTransportIdentifierResponseDocument_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportSecondaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportSecondaryResponseDocument.cs new file mode 100644 index 0000000000..4c811388a9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportSecondaryResponseDocument.cs @@ -0,0 +1,105 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class NullableTransportSecondaryResponseDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public Transport? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public Transport Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The included property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Included { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } +#nullable restore +#else + public List Included { + get { return BackingStore?.Get>("included"); } + set { BackingStore?.Set("included", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public NullableTransportSecondaryResponseDocument_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public NullableTransportSecondaryResponseDocument_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new nullableTransportSecondaryResponseDocument and sets the default values. + /// + public NullableTransportSecondaryResponseDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static NullableTransportSecondaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new NullableTransportSecondaryResponseDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(Transport.CreateFromDiscriminatorValue); } }, + {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(NullableTransportSecondaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportSecondaryResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportSecondaryResponseDocument_meta.cs new file mode 100644 index 0000000000..f4d780d1a2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportSecondaryResponseDocument_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class NullableTransportSecondaryResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new nullableTransportSecondaryResponseDocument_meta and sets the default values. + /// + public NullableTransportSecondaryResponseDocument_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static NullableTransportSecondaryResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new NullableTransportSecondaryResponseDocument_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipLinks.cs new file mode 100644 index 0000000000..98057bd8b2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipLinks.cs @@ -0,0 +1,73 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class RelationshipLinks : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The related property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Related { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } +#nullable restore +#else + public string Related { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } +#endif + /// The self property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Self { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } +#nullable restore +#else + public string Self { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } +#endif + /// + /// Instantiates a new relationshipLinks and sets the default values. + /// + public RelationshipLinks() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new RelationshipLinks(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"related", n => { Related = n.GetStringValue(); } }, + {"self", n => { Self = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..b39e3c71cc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs @@ -0,0 +1,137 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ResourceCollectionTopLevelLinks : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The describedby property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Describedby { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } +#nullable restore +#else + public string Describedby { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } +#endif + /// The first property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? First { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } +#nullable restore +#else + public string First { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } +#endif + /// The last property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Last { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } +#nullable restore +#else + public string Last { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } +#endif + /// The next property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Next { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } +#nullable restore +#else + public string Next { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } +#endif + /// The prev property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Prev { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } +#nullable restore +#else + public string Prev { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } +#endif + /// The self property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Self { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } +#nullable restore +#else + public string Self { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } +#endif + /// + /// Instantiates a new resourceCollectionTopLevelLinks and sets the default values. + /// + public ResourceCollectionTopLevelLinks() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ResourceCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ResourceCollectionTopLevelLinks(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"describedby", n => { Describedby = n.GetStringValue(); } }, + {"first", n => { First = n.GetStringValue(); } }, + {"last", n => { Last = n.GetStringValue(); } }, + {"next", n => { Next = n.GetStringValue(); } }, + {"prev", n => { Prev = n.GetStringValue(); } }, + {"self", n => { Self = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("self", Self); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..85279bebdd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -0,0 +1,153 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The describedby property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Describedby { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } +#nullable restore +#else + public string Describedby { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } +#endif + /// The first property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? First { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } +#nullable restore +#else + public string First { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } +#endif + /// The last property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Last { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } +#nullable restore +#else + public string Last { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } +#endif + /// The next property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Next { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } +#nullable restore +#else + public string Next { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } +#endif + /// The prev property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Prev { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } +#nullable restore +#else + public string Prev { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } +#endif + /// The related property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Related { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } +#nullable restore +#else + public string Related { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } +#endif + /// The self property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Self { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } +#nullable restore +#else + public string Self { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } +#endif + /// + /// Instantiates a new resourceIdentifierCollectionTopLevelLinks and sets the default values. + /// + public ResourceIdentifierCollectionTopLevelLinks() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ResourceIdentifierCollectionTopLevelLinks(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"describedby", n => { Describedby = n.GetStringValue(); } }, + {"first", n => { First = n.GetStringValue(); } }, + {"last", n => { Last = n.GetStringValue(); } }, + {"next", n => { Next = n.GetStringValue(); } }, + {"prev", n => { Prev = n.GetStringValue(); } }, + {"related", n => { Related = n.GetStringValue(); } }, + {"self", n => { Self = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs new file mode 100644 index 0000000000..f7a4b50f6e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs @@ -0,0 +1,89 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ResourceIdentifierTopLevelLinks : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The describedby property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Describedby { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } +#nullable restore +#else + public string Describedby { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } +#endif + /// The related property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Related { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } +#nullable restore +#else + public string Related { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } +#endif + /// The self property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Self { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } +#nullable restore +#else + public string Self { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } +#endif + /// + /// Instantiates a new resourceIdentifierTopLevelLinks and sets the default values. + /// + public ResourceIdentifierTopLevelLinks() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ResourceIdentifierTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ResourceIdentifierTopLevelLinks(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"describedby", n => { Describedby = n.GetStringValue(); } }, + {"related", n => { Related = n.GetStringValue(); } }, + {"self", n => { Self = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceLinks.cs new file mode 100644 index 0000000000..2c34fb8cc6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceLinks.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ResourceLinks : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The self property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Self { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } +#nullable restore +#else + public string Self { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } +#endif + /// + /// Instantiates a new resourceLinks and sets the default values. + /// + public ResourceLinks() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ResourceLinks(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"self", n => { Self = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("self", Self); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..95f77f9fb0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,73 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ResourceTopLevelLinks : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The describedby property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Describedby { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } +#nullable restore +#else + public string Describedby { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } +#endif + /// The self property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Self { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } +#nullable restore +#else + public string Self { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } +#endif + /// + /// Instantiates a new resourceTopLevelLinks and sets the default values. + /// + public ResourceTopLevelLinks() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ResourceTopLevelLinks(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"describedby", n => { Describedby = n.GetStringValue(); } }, + {"self", n => { Self = n.GetStringValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInRequest.cs new file mode 100644 index 0000000000..cedff035f7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInRequest.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ToManyExcursionInRequest : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Data { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public List Data { + get { return BackingStore?.Get>("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// + /// Instantiates a new toManyExcursionInRequest and sets the default values. + /// + public ToManyExcursionInRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ToManyExcursionInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ToManyExcursionInRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetCollectionOfObjectValues(ExcursionIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInResponse.cs new file mode 100644 index 0000000000..e644524f39 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInResponse.cs @@ -0,0 +1,89 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ToManyExcursionInResponse : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Data { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public List Data { + get { return BackingStore?.Get>("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ToManyExcursionInResponse_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public ToManyExcursionInResponse_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new toManyExcursionInResponse and sets the default values. + /// + public ToManyExcursionInResponse() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ToManyExcursionInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ToManyExcursionInResponse(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetCollectionOfObjectValues(ExcursionIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(ToManyExcursionInResponse_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInResponse_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInResponse_meta.cs new file mode 100644 index 0000000000..1e41662904 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInResponse_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ToManyExcursionInResponse_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new toManyExcursionInResponse_meta and sets the default values. + /// + public ToManyExcursionInResponse_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ToManyExcursionInResponse_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ToManyExcursionInResponse_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInRequest.cs new file mode 100644 index 0000000000..1147642260 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInRequest.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ToOneAccommodationInRequest : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationIdentifier? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public AccommodationIdentifier Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// + /// Instantiates a new toOneAccommodationInRequest and sets the default values. + /// + public ToOneAccommodationInRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ToOneAccommodationInRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ToOneAccommodationInRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(AccommodationIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInResponse.cs new file mode 100644 index 0000000000..ead2bdad3e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInResponse.cs @@ -0,0 +1,89 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ToOneAccommodationInResponse : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public AccommodationIdentifier? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public AccommodationIdentifier Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ToOneAccommodationInResponse_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public ToOneAccommodationInResponse_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new toOneAccommodationInResponse and sets the default values. + /// + public ToOneAccommodationInResponse() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ToOneAccommodationInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ToOneAccommodationInResponse(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(AccommodationIdentifier.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(ToOneAccommodationInResponse_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInResponse_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInResponse_meta.cs new file mode 100644 index 0000000000..9cb616950d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInResponse_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class ToOneAccommodationInResponse_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new toOneAccommodationInResponse_meta and sets the default values. + /// + public ToOneAccommodationInResponse_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static ToOneAccommodationInResponse_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new ToOneAccommodationInResponse_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Transport.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Transport.cs new file mode 100644 index 0000000000..ba26a51eae --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Transport.cs @@ -0,0 +1,81 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class Transport : DataInResponse, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public TransportAttributesInResponse? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public TransportAttributesInResponse Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public Transport_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public Transport_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static new Transport CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new Transport(); + } + /// + /// The deserialization information for the current model + /// + public override IDictionary> GetFieldDeserializers() { + return new Dictionary>(base.GetFieldDeserializers()) { + {"attributes", n => { Attributes = n.GetObjectValue(TransportAttributesInResponse.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(Transport_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportAttributesInPatchRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportAttributesInPatchRequest.cs new file mode 100644 index 0000000000..f4db850862 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportAttributesInPatchRequest.cs @@ -0,0 +1,55 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class TransportAttributesInPatchRequest : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The durationInMinutes property + public int? DurationInMinutes { + get { return BackingStore?.Get("durationInMinutes"); } + set { BackingStore?.Set("durationInMinutes", value); } + } + /// The type property + public int? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + /// + /// Instantiates a new transportAttributesInPatchRequest and sets the default values. + /// + public TransportAttributesInPatchRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static TransportAttributesInPatchRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new TransportAttributesInPatchRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"durationInMinutes", n => { DurationInMinutes = n.GetIntValue(); } }, + {"type", n => { Type = n.GetIntValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteIntValue("durationInMinutes", DurationInMinutes); + writer.WriteIntValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportAttributesInPostRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportAttributesInPostRequest.cs new file mode 100644 index 0000000000..3e0d3bbc83 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportAttributesInPostRequest.cs @@ -0,0 +1,55 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class TransportAttributesInPostRequest : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The durationInMinutes property + public int? DurationInMinutes { + get { return BackingStore?.Get("durationInMinutes"); } + set { BackingStore?.Set("durationInMinutes", value); } + } + /// The type property + public int? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + /// + /// Instantiates a new transportAttributesInPostRequest and sets the default values. + /// + public TransportAttributesInPostRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static TransportAttributesInPostRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new TransportAttributesInPostRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"durationInMinutes", n => { DurationInMinutes = n.GetIntValue(); } }, + {"type", n => { Type = n.GetIntValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteIntValue("durationInMinutes", DurationInMinutes); + writer.WriteIntValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportAttributesInResponse.cs new file mode 100644 index 0000000000..b388168320 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportAttributesInResponse.cs @@ -0,0 +1,55 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class TransportAttributesInResponse : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The durationInMinutes property + public int? DurationInMinutes { + get { return BackingStore?.Get("durationInMinutes"); } + set { BackingStore?.Set("durationInMinutes", value); } + } + /// The type property + public int? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + /// + /// Instantiates a new transportAttributesInResponse and sets the default values. + /// + public TransportAttributesInResponse() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static TransportAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new TransportAttributesInResponse(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"durationInMinutes", n => { DurationInMinutes = n.GetIntValue(); } }, + {"type", n => { Type = n.GetIntValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteIntValue("durationInMinutes", DurationInMinutes); + writer.WriteIntValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportCollectionResponseDocument.cs new file mode 100644 index 0000000000..7bcba8ca99 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportCollectionResponseDocument.cs @@ -0,0 +1,105 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class TransportCollectionResponseDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Data { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public List Data { + get { return BackingStore?.Get>("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The included property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Included { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } +#nullable restore +#else + public List Included { + get { return BackingStore?.Get>("included"); } + set { BackingStore?.Set("included", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public TransportCollectionResponseDocument_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public TransportCollectionResponseDocument_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new transportCollectionResponseDocument and sets the default values. + /// + public TransportCollectionResponseDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static TransportCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new TransportCollectionResponseDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetCollectionOfObjectValues(TransportDataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, + {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, + {"links", n => { Links = n.GetObjectValue(ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(TransportCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportCollectionResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportCollectionResponseDocument_meta.cs new file mode 100644 index 0000000000..075dcf4494 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportCollectionResponseDocument_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class TransportCollectionResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new transportCollectionResponseDocument_meta and sets the default values. + /// + public TransportCollectionResponseDocument_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static TransportCollectionResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new TransportCollectionResponseDocument_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInPatchRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInPatchRequest.cs new file mode 100644 index 0000000000..2f36f969ed --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInPatchRequest.cs @@ -0,0 +1,80 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class TransportDataInPatchRequest : IBackedModel, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public TransportAttributesInPatchRequest? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public TransportAttributesInPatchRequest Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#nullable restore +#else + public string Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#endif + /// The type property + public TransportResourceType? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + /// + /// Instantiates a new transportDataInPatchRequest and sets the default values. + /// + public TransportDataInPatchRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static TransportDataInPatchRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new TransportDataInPatchRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"attributes", n => { Attributes = n.GetObjectValue(TransportAttributesInPatchRequest.CreateFromDiscriminatorValue); } }, + {"id", n => { Id = n.GetStringValue(); } }, + {"type", n => { Type = n.GetEnumValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteEnumValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInPostRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInPostRequest.cs new file mode 100644 index 0000000000..785975b967 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInPostRequest.cs @@ -0,0 +1,64 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class TransportDataInPostRequest : IBackedModel, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public TransportAttributesInPostRequest? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public TransportAttributesInPostRequest Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The type property + public TransportResourceType? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + /// + /// Instantiates a new transportDataInPostRequest and sets the default values. + /// + public TransportDataInPostRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static TransportDataInPostRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new TransportDataInPostRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"attributes", n => { Attributes = n.GetObjectValue(TransportAttributesInPostRequest.CreateFromDiscriminatorValue); } }, + {"type", n => { Type = n.GetEnumValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteEnumValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInResponse.cs new file mode 100644 index 0000000000..2f42b519c9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInResponse.cs @@ -0,0 +1,81 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class TransportDataInResponse : DataInResponse, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public TransportAttributesInResponse? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public TransportAttributesInResponse Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public TransportDataInResponse_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public TransportDataInResponse_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static new TransportDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new TransportDataInResponse(); + } + /// + /// The deserialization information for the current model + /// + public override IDictionary> GetFieldDeserializers() { + return new Dictionary>(base.GetFieldDeserializers()) { + {"attributes", n => { Attributes = n.GetObjectValue(TransportAttributesInResponse.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(TransportDataInResponse_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInResponse_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInResponse_meta.cs new file mode 100644 index 0000000000..b5d3d7681a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInResponse_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class TransportDataInResponse_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new transportDataInResponse_meta and sets the default values. + /// + public TransportDataInResponse_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static TransportDataInResponse_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new TransportDataInResponse_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifier.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifier.cs new file mode 100644 index 0000000000..cbf39a3c3e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifier.cs @@ -0,0 +1,64 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class TransportIdentifier : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#nullable restore +#else + public string Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#endif + /// The type property + public TransportResourceType? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + /// + /// Instantiates a new transportIdentifier and sets the default values. + /// + public TransportIdentifier() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static TransportIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new TransportIdentifier(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"id", n => { Id = n.GetStringValue(); } }, + {"type", n => { Type = n.GetEnumValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteEnumValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPatchRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPatchRequestDocument.cs new file mode 100644 index 0000000000..35b5e0a769 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPatchRequestDocument.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class TransportPatchRequestDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public TransportDataInPatchRequest? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public TransportDataInPatchRequest Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// + /// Instantiates a new transportPatchRequestDocument and sets the default values. + /// + public TransportPatchRequestDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static TransportPatchRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new TransportPatchRequestDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(TransportDataInPatchRequest.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPostRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPostRequestDocument.cs new file mode 100644 index 0000000000..f433d95aed --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPostRequestDocument.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class TransportPostRequestDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public TransportDataInPostRequest? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public TransportDataInPostRequest Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// + /// Instantiates a new transportPostRequestDocument and sets the default values. + /// + public TransportPostRequestDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static TransportPostRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new TransportPostRequestDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(TransportDataInPostRequest.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPrimaryResponseDocument.cs new file mode 100644 index 0000000000..c52c3a2dcc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPrimaryResponseDocument.cs @@ -0,0 +1,105 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class TransportPrimaryResponseDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public Transports? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public Transports Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The included property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Included { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } +#nullable restore +#else + public List Included { + get { return BackingStore?.Get>("included"); } + set { BackingStore?.Set("included", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public TransportPrimaryResponseDocument_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public TransportPrimaryResponseDocument_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new transportPrimaryResponseDocument and sets the default values. + /// + public TransportPrimaryResponseDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static TransportPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new TransportPrimaryResponseDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(Transports.CreateFromDiscriminatorValue); } }, + {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(TransportPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPrimaryResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPrimaryResponseDocument_meta.cs new file mode 100644 index 0000000000..1ade721f83 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportPrimaryResponseDocument_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class TransportPrimaryResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new transportPrimaryResponseDocument_meta and sets the default values. + /// + public TransportPrimaryResponseDocument_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static TransportPrimaryResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new TransportPrimaryResponseDocument_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportResourceType.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportResourceType.cs new file mode 100644 index 0000000000..e74c098cef --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportResourceType.cs @@ -0,0 +1,9 @@ +// +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public enum TransportResourceType { + [EnumMember(Value = "transports")] + Transports, + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Transport_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Transport_meta.cs new file mode 100644 index 0000000000..ee2bcc588a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Transport_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class Transport_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new transport_meta and sets the default values. + /// + public Transport_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static Transport_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new Transport_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Transports.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Transports.cs new file mode 100644 index 0000000000..e61b3e2986 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Transports.cs @@ -0,0 +1,81 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class Transports : DataInResponse, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public TransportAttributesInResponse? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public TransportAttributesInResponse Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public Transports_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public Transports_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static new Transports CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new Transports(); + } + /// + /// The deserialization information for the current model + /// + public override IDictionary> GetFieldDeserializers() { + return new Dictionary>(base.GetFieldDeserializers()) { + {"attributes", n => { Attributes = n.GetObjectValue(TransportAttributesInResponse.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(Transports_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Transports_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Transports_meta.cs new file mode 100644 index 0000000000..a7882ffaa3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Transports_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class Transports_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new transports_meta and sets the default values. + /// + public Transports_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static Transports_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new Transports_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationAttributesInPatchRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationAttributesInPatchRequest.cs new file mode 100644 index 0000000000..1ad613d77b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationAttributesInPatchRequest.cs @@ -0,0 +1,55 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationAttributesInPatchRequest : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The endsAt property + public DateTimeOffset? EndsAt { + get { return BackingStore?.Get("endsAt"); } + set { BackingStore?.Set("endsAt", value); } + } + /// The startsAt property + public DateTimeOffset? StartsAt { + get { return BackingStore?.Get("startsAt"); } + set { BackingStore?.Set("startsAt", value); } + } + /// + /// Instantiates a new vacationAttributesInPatchRequest and sets the default values. + /// + public VacationAttributesInPatchRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationAttributesInPatchRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationAttributesInPatchRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"endsAt", n => { EndsAt = n.GetDateTimeOffsetValue(); } }, + {"startsAt", n => { StartsAt = n.GetDateTimeOffsetValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteDateTimeOffsetValue("endsAt", EndsAt); + writer.WriteDateTimeOffsetValue("startsAt", StartsAt); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationAttributesInPostRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationAttributesInPostRequest.cs new file mode 100644 index 0000000000..95bb3cfb1e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationAttributesInPostRequest.cs @@ -0,0 +1,55 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationAttributesInPostRequest : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The endsAt property + public DateTimeOffset? EndsAt { + get { return BackingStore?.Get("endsAt"); } + set { BackingStore?.Set("endsAt", value); } + } + /// The startsAt property + public DateTimeOffset? StartsAt { + get { return BackingStore?.Get("startsAt"); } + set { BackingStore?.Set("startsAt", value); } + } + /// + /// Instantiates a new vacationAttributesInPostRequest and sets the default values. + /// + public VacationAttributesInPostRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationAttributesInPostRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationAttributesInPostRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"endsAt", n => { EndsAt = n.GetDateTimeOffsetValue(); } }, + {"startsAt", n => { StartsAt = n.GetDateTimeOffsetValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteDateTimeOffsetValue("endsAt", EndsAt); + writer.WriteDateTimeOffsetValue("startsAt", StartsAt); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationAttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationAttributesInResponse.cs new file mode 100644 index 0000000000..61b14b94e5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationAttributesInResponse.cs @@ -0,0 +1,55 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationAttributesInResponse : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The endsAt property + public DateTimeOffset? EndsAt { + get { return BackingStore?.Get("endsAt"); } + set { BackingStore?.Set("endsAt", value); } + } + /// The startsAt property + public DateTimeOffset? StartsAt { + get { return BackingStore?.Get("startsAt"); } + set { BackingStore?.Set("startsAt", value); } + } + /// + /// Instantiates a new vacationAttributesInResponse and sets the default values. + /// + public VacationAttributesInResponse() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationAttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationAttributesInResponse(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"endsAt", n => { EndsAt = n.GetDateTimeOffsetValue(); } }, + {"startsAt", n => { StartsAt = n.GetDateTimeOffsetValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteDateTimeOffsetValue("endsAt", EndsAt); + writer.WriteDateTimeOffsetValue("startsAt", StartsAt); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationCollectionResponseDocument.cs new file mode 100644 index 0000000000..6bf1d85dbd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationCollectionResponseDocument.cs @@ -0,0 +1,105 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationCollectionResponseDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Data { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public List Data { + get { return BackingStore?.Get>("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The included property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Included { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } +#nullable restore +#else + public List Included { + get { return BackingStore?.Get>("included"); } + set { BackingStore?.Set("included", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public VacationCollectionResponseDocument_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public VacationCollectionResponseDocument_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new vacationCollectionResponseDocument and sets the default values. + /// + public VacationCollectionResponseDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationCollectionResponseDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetCollectionOfObjectValues(VacationDataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, + {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, + {"links", n => { Links = n.GetObjectValue(ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(VacationCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationCollectionResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationCollectionResponseDocument_meta.cs new file mode 100644 index 0000000000..4e69d02996 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationCollectionResponseDocument_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationCollectionResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new vacationCollectionResponseDocument_meta and sets the default values. + /// + public VacationCollectionResponseDocument_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationCollectionResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationCollectionResponseDocument_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInPatchRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInPatchRequest.cs new file mode 100644 index 0000000000..bbf490861a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInPatchRequest.cs @@ -0,0 +1,96 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationDataInPatchRequest : IBackedModel, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public VacationAttributesInPatchRequest? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public VacationAttributesInPatchRequest Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The id property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#nullable restore +#else + public string Id { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } +#endif + /// The relationships property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public VacationRelationshipsInPatchRequest? Relationships { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } +#nullable restore +#else + public VacationRelationshipsInPatchRequest Relationships { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } +#endif + /// The type property + public VacationResourceType? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + /// + /// Instantiates a new vacationDataInPatchRequest and sets the default values. + /// + public VacationDataInPatchRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationDataInPatchRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationDataInPatchRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"attributes", n => { Attributes = n.GetObjectValue(VacationAttributesInPatchRequest.CreateFromDiscriminatorValue); } }, + {"id", n => { Id = n.GetStringValue(); } }, + {"relationships", n => { Relationships = n.GetObjectValue(VacationRelationshipsInPatchRequest.CreateFromDiscriminatorValue); } }, + {"type", n => { Type = n.GetEnumValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("relationships", Relationships); + writer.WriteEnumValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInPostRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInPostRequest.cs new file mode 100644 index 0000000000..118b4e85c5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInPostRequest.cs @@ -0,0 +1,80 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationDataInPostRequest : IBackedModel, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public VacationAttributesInPostRequest? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public VacationAttributesInPostRequest Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The relationships property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public VacationRelationshipsInPostRequest? Relationships { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } +#nullable restore +#else + public VacationRelationshipsInPostRequest Relationships { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } +#endif + /// The type property + public VacationResourceType? Type { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + /// + /// Instantiates a new vacationDataInPostRequest and sets the default values. + /// + public VacationDataInPostRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationDataInPostRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationDataInPostRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"attributes", n => { Attributes = n.GetObjectValue(VacationAttributesInPostRequest.CreateFromDiscriminatorValue); } }, + {"relationships", n => { Relationships = n.GetObjectValue(VacationRelationshipsInPostRequest.CreateFromDiscriminatorValue); } }, + {"type", n => { Type = n.GetEnumValue(); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("relationships", Relationships); + writer.WriteEnumValue("type", Type); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInResponse.cs new file mode 100644 index 0000000000..354f9ee3ca --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInResponse.cs @@ -0,0 +1,97 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationDataInResponse : DataInResponse, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public VacationAttributesInResponse? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public VacationAttributesInResponse Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public VacationDataInResponse_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public VacationDataInResponse_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// The relationships property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public VacationRelationshipsInResponse? Relationships { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } +#nullable restore +#else + public VacationRelationshipsInResponse Relationships { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static new VacationDataInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationDataInResponse(); + } + /// + /// The deserialization information for the current model + /// + public override IDictionary> GetFieldDeserializers() { + return new Dictionary>(base.GetFieldDeserializers()) { + {"attributes", n => { Attributes = n.GetObjectValue(VacationAttributesInResponse.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(VacationDataInResponse_meta.CreateFromDiscriminatorValue); } }, + {"relationships", n => { Relationships = n.GetObjectValue(VacationRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("relationships", Relationships); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInResponse_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInResponse_meta.cs new file mode 100644 index 0000000000..3a51e7712e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInResponse_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationDataInResponse_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new vacationDataInResponse_meta and sets the default values. + /// + public VacationDataInResponse_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationDataInResponse_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationDataInResponse_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPatchRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPatchRequestDocument.cs new file mode 100644 index 0000000000..3ab958f2de --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPatchRequestDocument.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationPatchRequestDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public VacationDataInPatchRequest? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public VacationDataInPatchRequest Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// + /// Instantiates a new vacationPatchRequestDocument and sets the default values. + /// + public VacationPatchRequestDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationPatchRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationPatchRequestDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(VacationDataInPatchRequest.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPostRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPostRequestDocument.cs new file mode 100644 index 0000000000..13ed2455c3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPostRequestDocument.cs @@ -0,0 +1,57 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationPostRequestDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public VacationDataInPostRequest? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public VacationDataInPostRequest Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// + /// Instantiates a new vacationPostRequestDocument and sets the default values. + /// + public VacationPostRequestDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationPostRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationPostRequestDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(VacationDataInPostRequest.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPrimaryResponseDocument.cs new file mode 100644 index 0000000000..9d4cb0d1dd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPrimaryResponseDocument.cs @@ -0,0 +1,105 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationPrimaryResponseDocument : IBackedModel, IParsable { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The data property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public Vacations? Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#nullable restore +#else + public Vacations Data { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } +#endif + /// The included property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public List? Included { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } +#nullable restore +#else + public List Included { + get { return BackingStore?.Get>("included"); } + set { BackingStore?.Set("included", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public VacationPrimaryResponseDocument_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public VacationPrimaryResponseDocument_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// + /// Instantiates a new vacationPrimaryResponseDocument and sets the default values. + /// + public VacationPrimaryResponseDocument() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationPrimaryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationPrimaryResponseDocument(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"data", n => { Data = n.GetObjectValue(Vacations.CreateFromDiscriminatorValue); } }, + {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(VacationPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPrimaryResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPrimaryResponseDocument_meta.cs new file mode 100644 index 0000000000..ca5dcb61da --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationPrimaryResponseDocument_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationPrimaryResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new vacationPrimaryResponseDocument_meta and sets the default values. + /// + public VacationPrimaryResponseDocument_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationPrimaryResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationPrimaryResponseDocument_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationRelationshipsInPatchRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationRelationshipsInPatchRequest.cs new file mode 100644 index 0000000000..404f492cef --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationRelationshipsInPatchRequest.cs @@ -0,0 +1,89 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationRelationshipsInPatchRequest : IBackedModel, IParsable { + /// The accommodation property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ToOneAccommodationInRequest? Accommodation { + get { return BackingStore?.Get("accommodation"); } + set { BackingStore?.Set("accommodation", value); } + } +#nullable restore +#else + public ToOneAccommodationInRequest Accommodation { + get { return BackingStore?.Get("accommodation"); } + set { BackingStore?.Set("accommodation", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The excursions property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ToManyExcursionInRequest? Excursions { + get { return BackingStore?.Get("excursions"); } + set { BackingStore?.Set("excursions", value); } + } +#nullable restore +#else + public ToManyExcursionInRequest Excursions { + get { return BackingStore?.Get("excursions"); } + set { BackingStore?.Set("excursions", value); } + } +#endif + /// The transport property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public NullableToOneTransportInRequest? Transport { + get { return BackingStore?.Get("transport"); } + set { BackingStore?.Set("transport", value); } + } +#nullable restore +#else + public NullableToOneTransportInRequest Transport { + get { return BackingStore?.Get("transport"); } + set { BackingStore?.Set("transport", value); } + } +#endif + /// + /// Instantiates a new vacationRelationshipsInPatchRequest and sets the default values. + /// + public VacationRelationshipsInPatchRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationRelationshipsInPatchRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationRelationshipsInPatchRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"accommodation", n => { Accommodation = n.GetObjectValue(ToOneAccommodationInRequest.CreateFromDiscriminatorValue); } }, + {"excursions", n => { Excursions = n.GetObjectValue(ToManyExcursionInRequest.CreateFromDiscriminatorValue); } }, + {"transport", n => { Transport = n.GetObjectValue(NullableToOneTransportInRequest.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("accommodation", Accommodation); + writer.WriteObjectValue("excursions", Excursions); + writer.WriteObjectValue("transport", Transport); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationRelationshipsInPostRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationRelationshipsInPostRequest.cs new file mode 100644 index 0000000000..35c831a554 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationRelationshipsInPostRequest.cs @@ -0,0 +1,89 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationRelationshipsInPostRequest : IBackedModel, IParsable { + /// The accommodation property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ToOneAccommodationInRequest? Accommodation { + get { return BackingStore?.Get("accommodation"); } + set { BackingStore?.Set("accommodation", value); } + } +#nullable restore +#else + public ToOneAccommodationInRequest Accommodation { + get { return BackingStore?.Get("accommodation"); } + set { BackingStore?.Set("accommodation", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The excursions property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ToManyExcursionInRequest? Excursions { + get { return BackingStore?.Get("excursions"); } + set { BackingStore?.Set("excursions", value); } + } +#nullable restore +#else + public ToManyExcursionInRequest Excursions { + get { return BackingStore?.Get("excursions"); } + set { BackingStore?.Set("excursions", value); } + } +#endif + /// The transport property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public NullableToOneTransportInRequest? Transport { + get { return BackingStore?.Get("transport"); } + set { BackingStore?.Set("transport", value); } + } +#nullable restore +#else + public NullableToOneTransportInRequest Transport { + get { return BackingStore?.Get("transport"); } + set { BackingStore?.Set("transport", value); } + } +#endif + /// + /// Instantiates a new vacationRelationshipsInPostRequest and sets the default values. + /// + public VacationRelationshipsInPostRequest() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationRelationshipsInPostRequest CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationRelationshipsInPostRequest(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"accommodation", n => { Accommodation = n.GetObjectValue(ToOneAccommodationInRequest.CreateFromDiscriminatorValue); } }, + {"excursions", n => { Excursions = n.GetObjectValue(ToManyExcursionInRequest.CreateFromDiscriminatorValue); } }, + {"transport", n => { Transport = n.GetObjectValue(NullableToOneTransportInRequest.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("accommodation", Accommodation); + writer.WriteObjectValue("excursions", Excursions); + writer.WriteObjectValue("transport", Transport); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationRelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationRelationshipsInResponse.cs new file mode 100644 index 0000000000..11a5e23c3b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationRelationshipsInResponse.cs @@ -0,0 +1,89 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class VacationRelationshipsInResponse : IBackedModel, IParsable { + /// The accommodation property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ToOneAccommodationInResponse? Accommodation { + get { return BackingStore?.Get("accommodation"); } + set { BackingStore?.Set("accommodation", value); } + } +#nullable restore +#else + public ToOneAccommodationInResponse Accommodation { + get { return BackingStore?.Get("accommodation"); } + set { BackingStore?.Set("accommodation", value); } + } +#endif + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// The excursions property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ToManyExcursionInResponse? Excursions { + get { return BackingStore?.Get("excursions"); } + set { BackingStore?.Set("excursions", value); } + } +#nullable restore +#else + public ToManyExcursionInResponse Excursions { + get { return BackingStore?.Get("excursions"); } + set { BackingStore?.Set("excursions", value); } + } +#endif + /// The transport property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public NullableToOneTransportInResponse? Transport { + get { return BackingStore?.Get("transport"); } + set { BackingStore?.Set("transport", value); } + } +#nullable restore +#else + public NullableToOneTransportInResponse Transport { + get { return BackingStore?.Get("transport"); } + set { BackingStore?.Set("transport", value); } + } +#endif + /// + /// Instantiates a new vacationRelationshipsInResponse and sets the default values. + /// + public VacationRelationshipsInResponse() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static VacationRelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new VacationRelationshipsInResponse(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + {"accommodation", n => { Accommodation = n.GetObjectValue(ToOneAccommodationInResponse.CreateFromDiscriminatorValue); } }, + {"excursions", n => { Excursions = n.GetObjectValue(ToManyExcursionInResponse.CreateFromDiscriminatorValue); } }, + {"transport", n => { Transport = n.GetObjectValue(NullableToOneTransportInResponse.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("accommodation", Accommodation); + writer.WriteObjectValue("excursions", Excursions); + writer.WriteObjectValue("transport", Transport); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationResourceType.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationResourceType.cs new file mode 100644 index 0000000000..f11fdd7661 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationResourceType.cs @@ -0,0 +1,9 @@ +// +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public enum VacationResourceType { + [EnumMember(Value = "vacations")] + Vacations, + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Vacations.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Vacations.cs new file mode 100644 index 0000000000..1bbd70c445 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Vacations.cs @@ -0,0 +1,97 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class Vacations : DataInResponse, IParsable { + /// The attributes property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public VacationAttributesInResponse? Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#nullable restore +#else + public VacationAttributesInResponse Attributes { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } +#endif + /// The links property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#nullable restore +#else + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public Vacations_meta? Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public Vacations_meta Meta { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif + /// The relationships property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public VacationRelationshipsInResponse? Relationships { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } +#nullable restore +#else + public VacationRelationshipsInResponse Relationships { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } +#endif + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static new Vacations CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new Vacations(); + } + /// + /// The deserialization information for the current model + /// + public override IDictionary> GetFieldDeserializers() { + return new Dictionary>(base.GetFieldDeserializers()) { + {"attributes", n => { Attributes = n.GetObjectValue(VacationAttributesInResponse.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, + {"meta", n => { Meta = n.GetObjectValue(Vacations_meta.CreateFromDiscriminatorValue); } }, + {"relationships", n => { Relationships = n.GetObjectValue(VacationRelationshipsInResponse.CreateFromDiscriminatorValue); } }, + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("relationships", Relationships); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Vacations_meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Vacations_meta.cs new file mode 100644 index 0000000000..6fe8ae31fa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Vacations_meta.cs @@ -0,0 +1,48 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models { + public class Vacations_meta : IAdditionalDataHolder, IBackedModel, IParsable { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData { + get { return BackingStore?.Get>("AdditionalData"); } + set { BackingStore?.Set("AdditionalData", value); } + } + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + /// + /// Instantiates a new vacations_meta and sets the default values. + /// + public Vacations_meta() { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// The parse node to use to read the discriminator value and create the object + public static Vacations_meta CreateFromDiscriminatorValue(IParseNode parseNode) { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new Vacations_meta(); + } + /// + /// The deserialization information for the current model + /// + public virtual IDictionary> GetFieldDeserializers() { + return new Dictionary> { + }; + } + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/Item/TransportsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/Item/TransportsItemRequestBuilder.cs new file mode 100644 index 0000000000..27b0a4e00c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/Item/TransportsItemRequestBuilder.cs @@ -0,0 +1,224 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports.Item { + /// + /// Builds and executes requests for operations under \transports\{id} + /// + public class TransportsItemRequestBuilder : BaseRequestBuilder { + /// + /// Instantiates a new TransportsItemRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TransportsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/transports/{id}{?query*}", pathParameters) { + } + /// + /// Instantiates a new TransportsItemRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TransportsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/transports/{id}{?query*}", rawUrl) { + } + /// + /// Deletes an existing transport by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task DeleteAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Retrieves an individual transport by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, TransportPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task HeadAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToHeadRequestInformation(requestConfiguration); + return await RequestAdapter.SendPrimitiveAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Updates an existing transport. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task PatchAsync(TransportPatchRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task PatchAsync(TransportPatchRequestDocument body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"409", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"422", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, TransportPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Deletes an existing transport by its identifier. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToDeleteRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Retrieves an individual transport by its identifier. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToHeadRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + /// + /// Updates an existing transport. + /// + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToPatchRequestInformation(TransportPatchRequestDocument body, Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToPatchRequestInformation(TransportPatchRequestDocument body, Action> requestConfiguration = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// The raw URL to use for the request builder. + public TransportsItemRequestBuilder WithUrl(string rawUrl) { + return new TransportsItemRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Retrieves an individual transport by its identifier. + /// + public class TransportsItemRequestBuilderGetQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + public class TransportsItemRequestBuilderHeadQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Updates an existing transport. + /// + public class TransportsItemRequestBuilderPatchQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/TransportsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/TransportsRequestBuilder.cs new file mode 100644 index 0000000000..441588ce03 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/TransportsRequestBuilder.cs @@ -0,0 +1,198 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports.Item; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports { + /// + /// Builds and executes requests for operations under \transports + /// + public class TransportsRequestBuilder : BaseRequestBuilder { + /// Gets an item from the OpenApiKiotaEndToEndTests.Links.GeneratedCode.transports.item collection + /// The identifier of the transport to retrieve. + public TransportsItemRequestBuilder this[string position] { get { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new TransportsItemRequestBuilder(urlTplParams, RequestAdapter); + } } + /// + /// Instantiates a new TransportsRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TransportsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/transports{?query*}", pathParameters) { + } + /// + /// Instantiates a new TransportsRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TransportsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/transports{?query*}", rawUrl) { + } + /// + /// Retrieves a collection of transports. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, TransportCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task HeadAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToHeadRequestInformation(requestConfiguration); + return await RequestAdapter.SendPrimitiveAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Creates a new transport. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task PostAsync(TransportPostRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task PostAsync(TransportPostRequestDocument body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"403", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"409", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"422", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, TransportPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Retrieves a collection of transports. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToHeadRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + /// + /// Creates a new transport. + /// + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToPostRequestInformation(TransportPostRequestDocument body, Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToPostRequestInformation(TransportPostRequestDocument body, Action> requestConfiguration = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// The raw URL to use for the request builder. + public TransportsRequestBuilder WithUrl(string rawUrl) { + return new TransportsRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Retrieves a collection of transports. + /// + public class TransportsRequestBuilderGetQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + public class TransportsRequestBuilderHeadQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Creates a new transport. + /// + public class TransportsRequestBuilderPostQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Accommodation/AccommodationRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Accommodation/AccommodationRequestBuilder.cs new file mode 100644 index 0000000000..3222b598fc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Accommodation/AccommodationRequestBuilder.cs @@ -0,0 +1,133 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Accommodation { + /// + /// Builds and executes requests for operations under \vacations\{id}\accommodation + /// + public class AccommodationRequestBuilder : BaseRequestBuilder { + /// + /// Instantiates a new AccommodationRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AccommodationRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/accommodation{?query*}", pathParameters) { + } + /// + /// Instantiates a new AccommodationRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AccommodationRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/accommodation{?query*}", rawUrl) { + } + /// + /// Retrieves the related accommodation of an individual vacation's accommodation relationship. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, AccommodationSecondaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task HeadAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToHeadRequestInformation(requestConfiguration); + return await RequestAdapter.SendPrimitiveAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Retrieves the related accommodation of an individual vacation's accommodation relationship. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToHeadRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// The raw URL to use for the request builder. + public AccommodationRequestBuilder WithUrl(string rawUrl) { + return new AccommodationRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Retrieves the related accommodation of an individual vacation's accommodation relationship. + /// + public class AccommodationRequestBuilderGetQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + public class AccommodationRequestBuilderHeadQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Excursions/ExcursionsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Excursions/ExcursionsRequestBuilder.cs new file mode 100644 index 0000000000..93840c463e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Excursions/ExcursionsRequestBuilder.cs @@ -0,0 +1,133 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Excursions { + /// + /// Builds and executes requests for operations under \vacations\{id}\excursions + /// + public class ExcursionsRequestBuilder : BaseRequestBuilder { + /// + /// Instantiates a new ExcursionsRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ExcursionsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/excursions{?query*}", pathParameters) { + } + /// + /// Instantiates a new ExcursionsRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ExcursionsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/excursions{?query*}", rawUrl) { + } + /// + /// Retrieves the related excursions of an individual vacation's excursions relationship. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, ExcursionCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task HeadAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToHeadRequestInformation(requestConfiguration); + return await RequestAdapter.SendPrimitiveAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Retrieves the related excursions of an individual vacation's excursions relationship. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToHeadRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// The raw URL to use for the request builder. + public ExcursionsRequestBuilder WithUrl(string rawUrl) { + return new ExcursionsRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Retrieves the related excursions of an individual vacation's excursions relationship. + /// + public class ExcursionsRequestBuilderGetQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + public class ExcursionsRequestBuilderHeadQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Accommodation/AccommodationRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Accommodation/AccommodationRequestBuilder.cs new file mode 100644 index 0000000000..bd368e9727 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Accommodation/AccommodationRequestBuilder.cs @@ -0,0 +1,174 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Accommodation { + /// + /// Builds and executes requests for operations under \vacations\{id}\relationships\accommodation + /// + public class AccommodationRequestBuilder : BaseRequestBuilder { + /// + /// Instantiates a new AccommodationRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AccommodationRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships/accommodation{?query*}", pathParameters) { + } + /// + /// Instantiates a new AccommodationRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AccommodationRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships/accommodation{?query*}", rawUrl) { + } + /// + /// Retrieves the related accommodation identity of an individual vacation's accommodation relationship. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, AccommodationIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task HeadAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToHeadRequestInformation(requestConfiguration); + return await RequestAdapter.SendPrimitiveAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Assigns an existing accommodation to the accommodation relationship of an individual vacation. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task PatchAsync(ToOneAccommodationInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task PatchAsync(ToOneAccommodationInRequest body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"409", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Retrieves the related accommodation identity of an individual vacation's accommodation relationship. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToHeadRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + /// + /// Assigns an existing accommodation to the accommodation relationship of an individual vacation. + /// + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToPatchRequestInformation(ToOneAccommodationInRequest body, Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToPatchRequestInformation(ToOneAccommodationInRequest body, Action> requestConfiguration = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// The raw URL to use for the request builder. + public AccommodationRequestBuilder WithUrl(string rawUrl) { + return new AccommodationRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Retrieves the related accommodation identity of an individual vacation's accommodation relationship. + /// + public class AccommodationRequestBuilderGetQueryParameters { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + public class AccommodationRequestBuilderHeadQueryParameters { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Excursions/ExcursionsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Excursions/ExcursionsRequestBuilder.cs new file mode 100644 index 0000000000..a2f361f3ba --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Excursions/ExcursionsRequestBuilder.cs @@ -0,0 +1,256 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Excursions { + /// + /// Builds and executes requests for operations under \vacations\{id}\relationships\excursions + /// + public class ExcursionsRequestBuilder : BaseRequestBuilder { + /// + /// Instantiates a new ExcursionsRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ExcursionsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships/excursions{?query*}", pathParameters) { + } + /// + /// Instantiates a new ExcursionsRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ExcursionsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships/excursions{?query*}", rawUrl) { + } + /// + /// Removes existing excursions from the excursions relationship of an individual vacation. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task DeleteAsync(ToManyExcursionInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task DeleteAsync(ToManyExcursionInRequest body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"409", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Retrieves the related excursion identities of an individual vacation's excursions relationship. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, ExcursionIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task HeadAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToHeadRequestInformation(requestConfiguration); + return await RequestAdapter.SendPrimitiveAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Assigns existing excursions to the excursions relationship of an individual vacation. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task PatchAsync(ToManyExcursionInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task PatchAsync(ToManyExcursionInRequest body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"409", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Adds existing excursions to the excursions relationship of an individual vacation. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task PostAsync(ToManyExcursionInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task PostAsync(ToManyExcursionInRequest body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"409", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Removes existing excursions from the excursions relationship of an individual vacation. + /// + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToDeleteRequestInformation(ToManyExcursionInRequest body, Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToDeleteRequestInformation(ToManyExcursionInRequest body, Action> requestConfiguration = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + return requestInfo; + } + /// + /// Retrieves the related excursion identities of an individual vacation's excursions relationship. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToHeadRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + /// + /// Assigns existing excursions to the excursions relationship of an individual vacation. + /// + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToPatchRequestInformation(ToManyExcursionInRequest body, Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToPatchRequestInformation(ToManyExcursionInRequest body, Action> requestConfiguration = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + return requestInfo; + } + /// + /// Adds existing excursions to the excursions relationship of an individual vacation. + /// + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToPostRequestInformation(ToManyExcursionInRequest body, Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToPostRequestInformation(ToManyExcursionInRequest body, Action> requestConfiguration = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// The raw URL to use for the request builder. + public ExcursionsRequestBuilder WithUrl(string rawUrl) { + return new ExcursionsRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Retrieves the related excursion identities of an individual vacation's excursions relationship. + /// + public class ExcursionsRequestBuilderGetQueryParameters { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + public class ExcursionsRequestBuilderHeadQueryParameters { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..ee43263f50 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,43 @@ +// +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Accommodation; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Excursions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Transport; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships { + /// + /// Builds and executes requests for operations under \vacations\{id}\relationships + /// + public class RelationshipsRequestBuilder : BaseRequestBuilder { + /// The accommodation property + public AccommodationRequestBuilder Accommodation { get => + new AccommodationRequestBuilder(PathParameters, RequestAdapter); + } + /// The excursions property + public ExcursionsRequestBuilder Excursions { get => + new ExcursionsRequestBuilder(PathParameters, RequestAdapter); + } + /// The transport property + public TransportRequestBuilder Transport { get => + new TransportRequestBuilder(PathParameters, RequestAdapter); + } + /// + /// Instantiates a new RelationshipsRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships", pathParameters) { + } + /// + /// Instantiates a new RelationshipsRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships", rawUrl) { + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Transport/TransportRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Transport/TransportRequestBuilder.cs new file mode 100644 index 0000000000..838a23dd99 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Transport/TransportRequestBuilder.cs @@ -0,0 +1,174 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Transport { + /// + /// Builds and executes requests for operations under \vacations\{id}\relationships\transport + /// + public class TransportRequestBuilder : BaseRequestBuilder { + /// + /// Instantiates a new TransportRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TransportRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships/transport{?query*}", pathParameters) { + } + /// + /// Instantiates a new TransportRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TransportRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships/transport{?query*}", rawUrl) { + } + /// + /// Retrieves the related transport identity of an individual vacation's transport relationship. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, NullableTransportIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task HeadAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToHeadRequestInformation(requestConfiguration); + return await RequestAdapter.SendPrimitiveAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Clears or assigns an existing transport to the transport relationship of an individual vacation. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task PatchAsync(NullableToOneTransportInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task PatchAsync(NullableToOneTransportInRequest body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"409", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Retrieves the related transport identity of an individual vacation's transport relationship. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToHeadRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + /// + /// Clears or assigns an existing transport to the transport relationship of an individual vacation. + /// + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToPatchRequestInformation(NullableToOneTransportInRequest body, Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToPatchRequestInformation(NullableToOneTransportInRequest body, Action> requestConfiguration = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// The raw URL to use for the request builder. + public TransportRequestBuilder WithUrl(string rawUrl) { + return new TransportRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Retrieves the related transport identity of an individual vacation's transport relationship. + /// + public class TransportRequestBuilderGetQueryParameters { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + public class TransportRequestBuilderHeadQueryParameters { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Transport/TransportRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Transport/TransportRequestBuilder.cs new file mode 100644 index 0000000000..6db3c159aa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Transport/TransportRequestBuilder.cs @@ -0,0 +1,133 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Transport { + /// + /// Builds and executes requests for operations under \vacations\{id}\transport + /// + public class TransportRequestBuilder : BaseRequestBuilder { + /// + /// Instantiates a new TransportRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TransportRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/transport{?query*}", pathParameters) { + } + /// + /// Instantiates a new TransportRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TransportRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/transport{?query*}", rawUrl) { + } + /// + /// Retrieves the related transport of an individual vacation's transport relationship. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, NullableTransportSecondaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task HeadAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToHeadRequestInformation(requestConfiguration); + return await RequestAdapter.SendPrimitiveAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Retrieves the related transport of an individual vacation's transport relationship. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToHeadRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// The raw URL to use for the request builder. + public TransportRequestBuilder WithUrl(string rawUrl) { + return new TransportRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Retrieves the related transport of an individual vacation's transport relationship. + /// + public class TransportRequestBuilderGetQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + public class TransportRequestBuilderHeadQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/VacationsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/VacationsItemRequestBuilder.cs new file mode 100644 index 0000000000..8a5ca07bbe --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/VacationsItemRequestBuilder.cs @@ -0,0 +1,244 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Accommodation; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Excursions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Transport; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item { + /// + /// Builds and executes requests for operations under \vacations\{id} + /// + public class VacationsItemRequestBuilder : BaseRequestBuilder { + /// The accommodation property + public AccommodationRequestBuilder Accommodation { get => + new AccommodationRequestBuilder(PathParameters, RequestAdapter); + } + /// The excursions property + public ExcursionsRequestBuilder Excursions { get => + new ExcursionsRequestBuilder(PathParameters, RequestAdapter); + } + /// The relationships property + public RelationshipsRequestBuilder Relationships { get => + new RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + /// The transport property + public TransportRequestBuilder Transport { get => + new TransportRequestBuilder(PathParameters, RequestAdapter); + } + /// + /// Instantiates a new VacationsItemRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public VacationsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}{?query*}", pathParameters) { + } + /// + /// Instantiates a new VacationsItemRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public VacationsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}{?query*}", rawUrl) { + } + /// + /// Deletes an existing vacation by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task DeleteAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Retrieves an individual vacation by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, VacationPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task HeadAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToHeadRequestInformation(requestConfiguration); + return await RequestAdapter.SendPrimitiveAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Updates an existing vacation. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task PatchAsync(VacationPatchRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task PatchAsync(VacationPatchRequestDocument body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"409", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"422", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, VacationPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Deletes an existing vacation by its identifier. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToDeleteRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Retrieves an individual vacation by its identifier. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToHeadRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + /// + /// Updates an existing vacation. + /// + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToPatchRequestInformation(VacationPatchRequestDocument body, Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToPatchRequestInformation(VacationPatchRequestDocument body, Action> requestConfiguration = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// The raw URL to use for the request builder. + public VacationsItemRequestBuilder WithUrl(string rawUrl) { + return new VacationsItemRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Retrieves an individual vacation by its identifier. + /// + public class VacationsItemRequestBuilderGetQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + public class VacationsItemRequestBuilderHeadQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Updates an existing vacation. + /// + public class VacationsItemRequestBuilderPatchQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/VacationsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/VacationsRequestBuilder.cs new file mode 100644 index 0000000000..e6eaba0db1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/VacationsRequestBuilder.cs @@ -0,0 +1,198 @@ +// +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations { + /// + /// Builds and executes requests for operations under \vacations + /// + public class VacationsRequestBuilder : BaseRequestBuilder { + /// Gets an item from the OpenApiKiotaEndToEndTests.Links.GeneratedCode.vacations.item collection + /// The identifier of the vacation to retrieve. + public VacationsItemRequestBuilder this[string position] { get { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new VacationsItemRequestBuilder(urlTplParams, RequestAdapter); + } } + /// + /// Instantiates a new VacationsRequestBuilder and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public VacationsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations{?query*}", pathParameters) { + } + /// + /// Instantiates a new VacationsRequestBuilder and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public VacationsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations{?query*}", rawUrl) { + } + /// + /// Retrieves a collection of vacations. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, VacationCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task HeadAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + var requestInfo = ToHeadRequestInformation(requestConfiguration); + return await RequestAdapter.SendPrimitiveAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + /// + /// Creates a new vacation. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task PostAsync(VacationPostRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) { +#nullable restore +#else + public async Task PostAsync(VacationPostRequestDocument body, Action> requestConfiguration = default, CancellationToken cancellationToken = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> { + {"400", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"403", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"404", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"409", ErrorResponseDocument.CreateFromDiscriminatorValue}, + {"422", ErrorResponseDocument.CreateFromDiscriminatorValue}, + }; + return await RequestAdapter.SendAsync(requestInfo, VacationPrimaryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Retrieves a collection of vacations. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + return requestInfo; + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToHeadRequestInformation(Action> requestConfiguration = default) { +#endif + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + /// + /// Creates a new vacation. + /// + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToPostRequestInformation(VacationPostRequestDocument body, Action>? requestConfiguration = default) { +#nullable restore +#else + public RequestInformation ToPostRequestInformation(VacationPostRequestDocument body, Action> requestConfiguration = default) { +#endif + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json", body); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// The raw URL to use for the request builder. + public VacationsRequestBuilder WithUrl(string rawUrl) { + return new VacationsRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Retrieves a collection of vacations. + /// + public class VacationsRequestBuilderGetQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + public class VacationsRequestBuilderHeadQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + /// + /// Creates a new vacation. + /// + public class VacationsRequestBuilderPostQueryParameters { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + [QueryParameter("query")] + public string? Query { get; set; } +#nullable restore +#else + [QueryParameter("query")] + public string Query { get; set; } +#endif + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj b/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj index dc3ad9c2b3..a66c69869b 100644 --- a/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj +++ b/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj @@ -34,6 +34,8 @@ Command="dotnet kiota generate --language CSharp --class-name ClientIdGenerationModesClient --namespace-name OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode --output ./ClientIdGenerationModes/GeneratedCode --backing-store --exclude-backward-compatible --clean-output --clear-cache --log-level Error --openapi ../OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json" /> + diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorResponseDocument.cs index b5cd8d4c03..9f343b9a52 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorResponseDocument.cs @@ -27,14 +27,14 @@ public List Errors { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInErrorDocument? Links { - get { return BackingStore?.Get("links"); } + public ErrorTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInErrorDocument Links { - get { return BackingStore?.Get("links"); } + public ErrorTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -74,7 +74,7 @@ public static ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode pars public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"errors", n => { Errors = n.GetCollectionOfObjectValues(ErrorObject.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInErrorDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ErrorResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -85,7 +85,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("errors", Errors); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInErrorDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorTopLevelLinks.cs similarity index 89% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInErrorDocument.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorTopLevelLinks.cs index 55aba20a25..b71ada3ee5 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInErrorDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { - public class LinksInErrorDocument : IBackedModel, IParsable { + public class ErrorTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInErrorDocument and sets the default values. + /// Instantiates a new errorTopLevelLinks and sets the default values. /// - public LinksInErrorDocument() { + public ErrorTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInErrorDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInErrorDocument(); + return new ErrorTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairCollectionResponseDocument.cs index af4f1ad716..3926d88c01 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairCollectionResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(NameValuePairDataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NameValuePairCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairDataInResponse.cs index d518c2ca9d..43a63d245e 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairDataInResponse.cs @@ -23,14 +23,14 @@ public NameValuePairAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public NameValuePairRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(NameValuePairAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NameValuePairDataInResponse_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(NameValuePairRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierCollectionResponseDocument.cs index 82b599d92b..aa7d4708a2 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierCollectionResponseDocument.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceIdentifierCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceIdentifierCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static NameValuePairIdentifierCollectionResponseDocument CreateFromDiscri public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(NameValuePairIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceIdentifierCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NameValuePairIdentifierCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairPrimaryResponseDocument.cs index b26aed2bb3..87e33662fd 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairPrimaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(NameValuePairs.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NameValuePairPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairs.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairs.cs index 25a3b758ca..d18df3c8f1 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairs.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairs.cs @@ -23,14 +23,14 @@ public NameValuePairAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public NameValuePairRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(NameValuePairAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NameValuePairs_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(NameValuePairRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeCollectionResponseDocument.cs index 97ffe6f896..976271dcf6 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeCollectionResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(NodeDataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NodeCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeDataInResponse.cs index 701e32fbf7..63f754f295 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeDataInResponse.cs @@ -23,14 +23,14 @@ public NodeAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public NodeRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(NodeAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NodeDataInResponse_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(NodeRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierCollectionResponseDocument.cs index 5214782009..b9dd8d675f 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierCollectionResponseDocument.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceIdentifierCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceIdentifierCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static NodeIdentifierCollectionResponseDocument CreateFromDiscriminatorVa public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(NodeIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceIdentifierCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NodeIdentifierCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierResponseDocument.cs index 60ea5d2fa6..9167000fc2 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierResponseDocument.cs @@ -26,14 +26,14 @@ public NodeIdentifier Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceIdentifierDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceIdentifierDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static NodeIdentifierResponseDocument CreateFromDiscriminatorValue(IParse public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(NodeIdentifier.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceIdentifierDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NodeIdentifierResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodePrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodePrimaryResponseDocument.cs index a7b1890552..b11a22e6ab 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodePrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodePrimaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(Nodes.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NodePrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeSecondaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeSecondaryResponseDocument.cs index c6ff108eb8..72cac6b4c0 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeSecondaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeSecondaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(Owner.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NodeSecondaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Nodes.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Nodes.cs index 43048e29f3..65c58561ce 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Nodes.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Nodes.cs @@ -23,14 +23,14 @@ public NodeAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public NodeRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(NodeAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(Nodes_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(NodeRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableNodeIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableNodeIdentifierResponseDocument.cs index 605caff767..c329b9dbfc 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableNodeIdentifierResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableNodeIdentifierResponseDocument.cs @@ -26,14 +26,14 @@ public NodeIdentifier Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceIdentifierDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceIdentifierDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static NullableNodeIdentifierResponseDocument CreateFromDiscriminatorValu public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(NodeIdentifier.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceIdentifierDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NullableNodeIdentifierResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableNodeSecondaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableNodeSecondaryResponseDocument.cs index 482b4039e8..0319597cdf 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableNodeSecondaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableNodeSecondaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(Parent.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NullableNodeSecondaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableToOneNodeInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableToOneNodeInResponse.cs index 5eaa208a00..833e772161 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableToOneNodeInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableToOneNodeInResponse.cs @@ -26,14 +26,14 @@ public NodeIdentifier Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static NullableToOneNodeInResponse CreateFromDiscriminatorValue(IParseNod public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(NodeIdentifier.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NullableToOneNodeInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Owner.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Owner.cs index 96948e7361..72ccb8bc6d 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Owner.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Owner.cs @@ -23,14 +23,14 @@ public NodeAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public NodeRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(NodeAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(Owner_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(NodeRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Parent.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Parent.cs index e122cfe54a..78261aa04c 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Parent.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Parent.cs @@ -23,14 +23,14 @@ public NodeAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public NodeRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(NodeAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(Parent_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(NodeRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInRelationship.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipLinks.cs similarity index 89% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInRelationship.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipLinks.cs index ea34f66b6d..a02ccc1c3e 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInRelationship.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { - public class LinksInRelationship : IBackedModel, IParsable { + public class RelationshipLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The related property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInRelationship and sets the default values. + /// Instantiates a new relationshipLinks and sets the default values. /// - public LinksInRelationship() { + public RelationshipLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInRelationship CreateFromDiscriminatorValue(IParseNode parseNode) { + public static RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInRelationship(); + return new RelationshipLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceCollectionDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs similarity index 92% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceCollectionDocument.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs index a512383879..2d259206fa 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceCollectionDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { - public class LinksInResourceCollectionDocument : IBackedModel, IParsable { + public class ResourceCollectionTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -94,18 +94,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceCollectionDocument and sets the default values. + /// Instantiates a new resourceCollectionTopLevelLinks and sets the default values. /// - public LinksInResourceCollectionDocument() { + public ResourceCollectionTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceCollectionDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceCollectionDocument(); + return new ResourceCollectionTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceIdentifierCollectionDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs similarity index 92% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceIdentifierCollectionDocument.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs index 25207dd9f5..e7bc51b4fa 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceIdentifierCollectionDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { - public class LinksInResourceIdentifierCollectionDocument : IBackedModel, IParsable { + public class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -108,18 +108,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceIdentifierCollectionDocument and sets the default values. + /// Instantiates a new resourceIdentifierCollectionTopLevelLinks and sets the default values. /// - public LinksInResourceIdentifierCollectionDocument() { + public ResourceIdentifierCollectionTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceIdentifierCollectionDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceIdentifierCollectionDocument(); + return new ResourceIdentifierCollectionTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceIdentifierDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs similarity index 89% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceIdentifierDocument.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs index 342d98002c..14715d70eb 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceIdentifierDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { - public class LinksInResourceIdentifierDocument : IBackedModel, IParsable { + public class ResourceIdentifierTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -52,18 +52,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceIdentifierDocument and sets the default values. + /// Instantiates a new resourceIdentifierTopLevelLinks and sets the default values. /// - public LinksInResourceIdentifierDocument() { + public ResourceIdentifierTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceIdentifierDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceIdentifierTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceIdentifierDocument(); + return new ResourceIdentifierTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceData.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceLinks.cs similarity index 86% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceData.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceLinks.cs index bf02688ba1..c07c6d1933 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceData.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { - public class LinksInResourceData : IBackedModel, IParsable { + public class ResourceLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The self property @@ -24,18 +24,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceData and sets the default values. + /// Instantiates a new resourceLinks and sets the default values. /// - public LinksInResourceData() { + public ResourceLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceData CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceData(); + return new ResourceLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceTopLevelLinks.cs similarity index 88% rename from test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceDocument.cs rename to test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceTopLevelLinks.cs index 8ac07bd75b..be8600aa96 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/LinksInResourceDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models { - public class LinksInResourceDocument : IBackedModel, IParsable { + public class ResourceTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceDocument and sets the default values. + /// Instantiates a new resourceTopLevelLinks and sets the default values. /// - public LinksInResourceDocument() { + public ResourceTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceDocument(); + return new ResourceTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNameValuePairInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNameValuePairInResponse.cs index 31235b3e27..67303ee3bb 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNameValuePairInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNameValuePairInResponse.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static ToManyNameValuePairInResponse CreateFromDiscriminatorValue(IParseN public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(NameValuePairIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ToManyNameValuePairInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNodeInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNodeInResponse.cs index 0fada50c4e..e9c84ad573 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNodeInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNodeInResponse.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static ToManyNodeInResponse CreateFromDiscriminatorValue(IParseNode parse public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(NodeIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ToManyNodeInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToOneNodeInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToOneNodeInResponse.cs index f69d9ca672..fa87a39ab6 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToOneNodeInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToOneNodeInResponse.cs @@ -26,14 +26,14 @@ public NodeIdentifier Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static ToOneNodeInResponse CreateFromDiscriminatorValue(IParseNode parseN public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(NodeIdentifier.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ToOneNodeInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamCollectionResponseDocument.cs index 158ddc441e..70f2f874bf 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamCollectionResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(DataStreamDataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(DataStreamCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamDataInResponse.cs index 38c5fd45c0..8cd1b21327 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamDataInResponse.cs @@ -23,14 +23,14 @@ public DataStreamAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -62,7 +62,7 @@ public DataStreamDataInResponse_meta Meta { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(DataStreamAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(DataStreamDataInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -74,7 +74,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierCollectionResponseDocument.cs index a754e5583f..3020474dfa 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierCollectionResponseDocument.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceIdentifierCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceIdentifierCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static DataStreamIdentifierCollectionResponseDocument CreateFromDiscrimin public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(DataStreamIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceIdentifierCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(DataStreamIdentifierCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierResponseDocument.cs index 2ceb60c7a6..900a1e697b 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierResponseDocument.cs @@ -26,14 +26,14 @@ public DataStreamIdentifier Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceIdentifierDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceIdentifierDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static DataStreamIdentifierResponseDocument CreateFromDiscriminatorValue( public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(DataStreamIdentifier.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceIdentifierDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(DataStreamIdentifierResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamPrimaryResponseDocument.cs index 3bd63c8167..8a2cf5d1f7 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamPrimaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(DataStreams.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(DataStreamPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamSecondaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamSecondaryResponseDocument.cs index 5a01d43e4b..dbf10a0c81 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamSecondaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamSecondaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(VideoStream.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(DataStreamSecondaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreams.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreams.cs index 6d1f2a9d23..473788cc71 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreams.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreams.cs @@ -23,14 +23,14 @@ public DataStreamAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -62,7 +62,7 @@ public DataStreams_meta Meta { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(DataStreamAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(DataStreams_meta.CreateFromDiscriminatorValue); } }, }; } @@ -74,7 +74,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorResponseDocument.cs index 618b385483..16ddaadafb 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorResponseDocument.cs @@ -27,14 +27,14 @@ public List Errors { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInErrorDocument? Links { - get { return BackingStore?.Get("links"); } + public ErrorTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInErrorDocument Links { - get { return BackingStore?.Get("links"); } + public ErrorTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -74,7 +74,7 @@ public static ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode pars public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"errors", n => { Errors = n.GetCollectionOfObjectValues(ErrorObject.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInErrorDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ErrorResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -85,7 +85,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("errors", Errors); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInErrorDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorTopLevelLinks.cs similarity index 89% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInErrorDocument.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorTopLevelLinks.cs index d24c7f45c2..7478db92a2 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInErrorDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { - public class LinksInErrorDocument : IBackedModel, IParsable { + public class ErrorTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInErrorDocument and sets the default values. + /// Instantiates a new errorTopLevelLinks and sets the default values. /// - public LinksInErrorDocument() { + public ErrorTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInErrorDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInErrorDocument(); + return new ErrorTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableDataStreamIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableDataStreamIdentifierResponseDocument.cs index 5f82ead6db..dfea1dc512 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableDataStreamIdentifierResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableDataStreamIdentifierResponseDocument.cs @@ -26,14 +26,14 @@ public DataStreamIdentifier Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceIdentifierDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceIdentifierDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceIdentifierTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static NullableDataStreamIdentifierResponseDocument CreateFromDiscriminat public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(DataStreamIdentifier.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceIdentifierDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NullableDataStreamIdentifierResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableDataStreamSecondaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableDataStreamSecondaryResponseDocument.cs index 38ccf0212d..aa8d936683 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableDataStreamSecondaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableDataStreamSecondaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(UltraHighDefinitionVideoStream.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NullableDataStreamSecondaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableToOneDataStreamInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableToOneDataStreamInResponse.cs index f1642b6a42..779c22373b 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableToOneDataStreamInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableToOneDataStreamInResponse.cs @@ -26,14 +26,14 @@ public DataStreamIdentifier Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static NullableToOneDataStreamInResponse CreateFromDiscriminatorValue(IPa public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(DataStreamIdentifier.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(NullableToOneDataStreamInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelCollectionResponseDocument.cs index 211c339691..0290625a80 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelCollectionResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(ReadOnlyChannelDataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ReadOnlyChannelCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelDataInResponse.cs index b5a7fd189d..4549ef2898 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelDataInResponse.cs @@ -23,14 +23,14 @@ public ReadOnlyChannelAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public ReadOnlyChannelRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(ReadOnlyChannelAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ReadOnlyChannelDataInResponse_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(ReadOnlyChannelRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelPrimaryResponseDocument.cs index c14be0aa50..2747f95a97 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelPrimaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(ReadOnlyChannels.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ReadOnlyChannelPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannels.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannels.cs index cf726bcac9..cdb26d9e4c 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannels.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannels.cs @@ -23,14 +23,14 @@ public ReadOnlyChannelAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public ReadOnlyChannelRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(ReadOnlyChannelAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ReadOnlyChannels_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(ReadOnlyChannelRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelCollectionResponseDocument.cs index 5d716965dc..50c4f2c710 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelCollectionResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelCollectionResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceCollectionDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceCollectionDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceCollectionTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(ReadOnlyResourceChannelDataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceCollectionDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ReadOnlyResourceChannelCollectionResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelDataInResponse.cs index 483cbf1e58..0312f4a87d 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelDataInResponse.cs @@ -23,14 +23,14 @@ public ReadOnlyResourceChannelAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public ReadOnlyResourceChannelRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(ReadOnlyResourceChannelAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ReadOnlyResourceChannelDataInResponse_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(ReadOnlyResourceChannelRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelPrimaryResponseDocument.cs index 52e7a34306..1e899eafe5 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelPrimaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(ReadOnlyResourceChannels.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ReadOnlyResourceChannelPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannels.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannels.cs index 36aed6a72a..69f10b4793 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannels.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannels.cs @@ -23,14 +23,14 @@ public ReadOnlyResourceChannelAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public ReadOnlyResourceChannelRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(ReadOnlyResourceChannelAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ReadOnlyResourceChannels_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(ReadOnlyResourceChannelRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInRelationship.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipLinks.cs similarity index 89% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInRelationship.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipLinks.cs index 458b09753e..a9249962cf 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInRelationship.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { - public class LinksInRelationship : IBackedModel, IParsable { + public class RelationshipLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The related property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInRelationship and sets the default values. + /// Instantiates a new relationshipLinks and sets the default values. /// - public LinksInRelationship() { + public RelationshipLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInRelationship CreateFromDiscriminatorValue(IParseNode parseNode) { + public static RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInRelationship(); + return new RelationshipLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceCollectionDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs similarity index 92% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceCollectionDocument.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs index e008a7ef80..332aae32af 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceCollectionDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { - public class LinksInResourceCollectionDocument : IBackedModel, IParsable { + public class ResourceCollectionTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -94,18 +94,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceCollectionDocument and sets the default values. + /// Instantiates a new resourceCollectionTopLevelLinks and sets the default values. /// - public LinksInResourceCollectionDocument() { + public ResourceCollectionTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceCollectionDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceCollectionDocument(); + return new ResourceCollectionTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceIdentifierCollectionDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs similarity index 92% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceIdentifierCollectionDocument.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs index 297bd13b25..1e06aa2ddd 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceIdentifierCollectionDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { - public class LinksInResourceIdentifierCollectionDocument : IBackedModel, IParsable { + public class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -108,18 +108,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceIdentifierCollectionDocument and sets the default values. + /// Instantiates a new resourceIdentifierCollectionTopLevelLinks and sets the default values. /// - public LinksInResourceIdentifierCollectionDocument() { + public ResourceIdentifierCollectionTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceIdentifierCollectionDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceIdentifierCollectionDocument(); + return new ResourceIdentifierCollectionTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceIdentifierDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs similarity index 89% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceIdentifierDocument.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs index 1501dcef5c..cf80eb4a24 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceIdentifierDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { - public class LinksInResourceIdentifierDocument : IBackedModel, IParsable { + public class ResourceIdentifierTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -52,18 +52,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceIdentifierDocument and sets the default values. + /// Instantiates a new resourceIdentifierTopLevelLinks and sets the default values. /// - public LinksInResourceIdentifierDocument() { + public ResourceIdentifierTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceIdentifierDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceIdentifierTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceIdentifierDocument(); + return new ResourceIdentifierTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceData.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceLinks.cs similarity index 86% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceData.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceLinks.cs index 7d08a4752a..de169e4c12 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceData.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { - public class LinksInResourceData : IBackedModel, IParsable { + public class ResourceLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The self property @@ -24,18 +24,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceData and sets the default values. + /// Instantiates a new resourceLinks and sets the default values. /// - public LinksInResourceData() { + public ResourceLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceData CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceData(); + return new ResourceLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceTopLevelLinks.cs similarity index 88% rename from test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceDocument.cs rename to test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceTopLevelLinks.cs index 85f981bea1..6187b68ab5 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/LinksInResourceDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -6,7 +6,7 @@ using System.Linq; using System; namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models { - public class LinksInResourceDocument : IBackedModel, IParsable { + public class ResourceTopLevelLinks : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } /// The describedby property @@ -38,18 +38,18 @@ public string Self { } #endif /// - /// Instantiates a new linksInResourceDocument and sets the default values. + /// Instantiates a new resourceTopLevelLinks and sets the default values. /// - public LinksInResourceDocument() { + public ResourceTopLevelLinks() { BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); } /// /// Creates a new instance of the appropriate class based on discriminator value /// /// The parse node to use to read the discriminator value and create the object - public static LinksInResourceDocument CreateFromDiscriminatorValue(IParseNode parseNode) { + public static ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - return new LinksInResourceDocument(); + return new ResourceTopLevelLinks(); } /// /// The deserialization information for the current model diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToManyDataStreamInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToManyDataStreamInResponse.cs index 44b9ce6511..a40ef98365 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToManyDataStreamInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToManyDataStreamInResponse.cs @@ -26,14 +26,14 @@ public List Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static ToManyDataStreamInResponse CreateFromDiscriminatorValue(IParseNode public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetCollectionOfObjectValues(DataStreamIdentifier.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ToManyDataStreamInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToOneDataStreamInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToOneDataStreamInResponse.cs index ab515544e0..bc84a97ae0 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToOneDataStreamInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToOneDataStreamInResponse.cs @@ -26,14 +26,14 @@ public DataStreamIdentifier Data { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInRelationship? Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInRelationship Links { - get { return BackingStore?.Get("links"); } + public RelationshipLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -71,7 +71,7 @@ public static ToOneDataStreamInResponse CreateFromDiscriminatorValue(IParseNode public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(DataStreamIdentifier.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInRelationship.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(RelationshipLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(ToOneDataStreamInResponse_meta.CreateFromDiscriminatorValue); } }, }; } @@ -82,7 +82,7 @@ public virtual IDictionary> GetFieldDeserializers() { public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/UltraHighDefinitionVideoStream.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/UltraHighDefinitionVideoStream.cs index 80c4c4fc8f..1bf18530fc 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/UltraHighDefinitionVideoStream.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/UltraHighDefinitionVideoStream.cs @@ -23,14 +23,14 @@ public DataStreamAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -62,7 +62,7 @@ public UltraHighDefinitionVideoStream_meta Meta { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(DataStreamAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(UltraHighDefinitionVideoStream_meta.CreateFromDiscriminatorValue); } }, }; } @@ -74,7 +74,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/VideoStream.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/VideoStream.cs index eb0d58e755..f1a01a3e54 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/VideoStream.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/VideoStream.cs @@ -23,14 +23,14 @@ public DataStreamAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -62,7 +62,7 @@ public VideoStream_meta Meta { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(DataStreamAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(VideoStream_meta.CreateFromDiscriminatorValue); } }, }; } @@ -74,7 +74,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelDataInResponse.cs index 5f2e816aba..d1596317fb 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelDataInResponse.cs @@ -23,14 +23,14 @@ public WriteOnlyChannelAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public WriteOnlyChannelRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(WriteOnlyChannelAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(WriteOnlyChannelDataInResponse_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(WriteOnlyChannelRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelPrimaryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelPrimaryResponseDocument.cs index be8841fcd2..8b7a1fe17e 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelPrimaryResponseDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelPrimaryResponseDocument.cs @@ -40,14 +40,14 @@ public List Included { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceDocument? Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceDocument Links { - get { return BackingStore?.Get("links"); } + public ResourceTopLevelLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -86,7 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { {"data", n => { Data = n.GetObjectValue(WriteOnlyChannels.CreateFromDiscriminatorValue); } }, {"included", n => { Included = n.GetCollectionOfObjectValues(DataInResponse.CreateFromDiscriminatorValue)?.ToList(); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceDocument.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(WriteOnlyChannelPrimaryResponseDocument_meta.CreateFromDiscriminatorValue); } }, }; } @@ -98,7 +98,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); writer.WriteCollectionOfObjectValues("included", Included); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannels.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannels.cs index 392a2578fe..4a10777536 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannels.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannels.cs @@ -23,14 +23,14 @@ public WriteOnlyChannelAttributesInResponse Attributes { /// The links property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable - public LinksInResourceData? Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks? Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #nullable restore #else - public LinksInResourceData Links { - get { return BackingStore?.Get("links"); } + public ResourceLinks Links { + get { return BackingStore?.Get("links"); } set { BackingStore?.Set("links", value); } } #endif @@ -76,7 +76,7 @@ public WriteOnlyChannelRelationshipsInResponse Relationships { public override IDictionary> GetFieldDeserializers() { return new Dictionary>(base.GetFieldDeserializers()) { {"attributes", n => { Attributes = n.GetObjectValue(WriteOnlyChannelAttributesInResponse.CreateFromDiscriminatorValue); } }, - {"links", n => { Links = n.GetObjectValue(LinksInResourceData.CreateFromDiscriminatorValue); } }, + {"links", n => { Links = n.GetObjectValue(ResourceLinks.CreateFromDiscriminatorValue); } }, {"meta", n => { Meta = n.GetObjectValue(WriteOnlyChannels_meta.CreateFromDiscriminatorValue); } }, {"relationships", n => { Relationships = n.GetObjectValue(WriteOnlyChannelRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; @@ -89,7 +89,7 @@ public override void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); base.Serialize(writer); writer.WriteObjectValue("attributes", Attributes); - writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("links", Links); writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } diff --git a/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs index 0b2bf9ad0c..18bf877654 100644 --- a/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs +++ b/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs @@ -66,13 +66,13 @@ public void Generated_top_level_document_types_are_named_as_expected() [Fact] public void Generated_link_types_are_named_as_expected() { - _ = nameof(LinksInResourceCollectionDocument); - _ = nameof(LinksInResourceDocument); - _ = nameof(LinksInResourceIdentifierCollectionDocument); - _ = nameof(LinksInResourceIdentifierDocument); - _ = nameof(LinksInResourceData); - _ = nameof(LinksInRelationship); - _ = nameof(LinksInErrorDocument); + _ = nameof(ResourceTopLevelLinks); + _ = nameof(ResourceCollectionTopLevelLinks); + _ = nameof(ResourceIdentifierTopLevelLinks); + _ = nameof(ResourceIdentifierCollectionTopLevelLinks); + _ = nameof(ErrorTopLevelLinks); + _ = nameof(ResourceLinks); + _ = nameof(RelationshipLinks); } [Fact] diff --git a/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs index c4784dd404..18e043b488 100644 --- a/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs +++ b/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs @@ -66,13 +66,13 @@ public void Generated_top_level_document_types_are_named_as_expected() [Fact] public void Generated_link_types_are_named_as_expected() { - _ = nameof(LinksInResourceCollectionDocument); - _ = nameof(LinksInResourceDocument); - _ = nameof(LinksInResourceIdentifierCollectionDocument); - _ = nameof(LinksInResourceIdentifierDocument); - _ = nameof(LinksInResourceData); - _ = nameof(LinksInRelationship); - _ = nameof(LinksInErrorDocument); + _ = nameof(ResourceTopLevelLinks); + _ = nameof(ResourceCollectionTopLevelLinks); + _ = nameof(ResourceIdentifierTopLevelLinks); + _ = nameof(ResourceIdentifierCollectionTopLevelLinks); + _ = nameof(ErrorTopLevelLinks); + _ = nameof(ResourceLinks); + _ = nameof(RelationshipLinks); } [Fact] diff --git a/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs index d7c7ecfcc3..b78c7bfa4f 100644 --- a/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs +++ b/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs @@ -66,13 +66,13 @@ public void Generated_top_level_document_types_are_named_as_expected() [Fact] public void Generated_link_types_are_named_as_expected() { - _ = nameof(LinksInResourceCollectionDocument); - _ = nameof(LinksInResourceDocument); - _ = nameof(LinksInResourceIdentifierCollectionDocument); - _ = nameof(LinksInResourceIdentifierDocument); - _ = nameof(LinksInResourceData); - _ = nameof(LinksInRelationship); - _ = nameof(LinksInErrorDocument); + _ = nameof(ResourceTopLevelLinks); + _ = nameof(ResourceCollectionTopLevelLinks); + _ = nameof(ResourceIdentifierTopLevelLinks); + _ = nameof(ResourceIdentifierCollectionTopLevelLinks); + _ = nameof(ErrorTopLevelLinks); + _ = nameof(ResourceLinks); + _ = nameof(RelationshipLinks); } [Fact] diff --git a/test/OpenApiNSwagEndToEndTests/Links/AlternateOpenApiRouteTests.cs b/test/OpenApiNSwagEndToEndTests/Links/AlternateOpenApiRouteTests.cs new file mode 100644 index 0000000000..4d96310190 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/Links/AlternateOpenApiRouteTests.cs @@ -0,0 +1,51 @@ +using FluentAssertions; +using Microsoft.Extensions.DependencyInjection; +using OpenApiNSwagEndToEndTests.Links.GeneratedCode; +using OpenApiTests; +using OpenApiTests.Links; +using Swashbuckle.AspNetCore.Swagger; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.Links; + +public sealed class AlternateOpenApiRouteTests : IClassFixture, LinkDbContext>> +{ + private readonly IntegrationTestContext, LinkDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly LinkFakers _fakers = new(); + + public AlternateOpenApiRouteTests(IntegrationTestContext, LinkDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.ConfigureServices(services => + services.Configure(options => options.RouteTemplate = "api-docs/{documentName}/swagger.yaml")); + + testContext.UseController(); + } + + [Fact] + public async Task DescribedBy_link_matches_alternate_OpenAPI_route() + { + // Arrange + Excursion excursion = _fakers.Excursion.Generate(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new LinksClient(httpClient); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Excursions.Add(excursion); + await dbContext.SaveChangesAsync(); + }); + + // Act + ExcursionPrimaryResponseDocument response = await apiClient.GetExcursionAsync(excursion.StringId!, null, null); + + // Assert + response.Links.Describedby.Should().Be("api-docs/v1/swagger.yaml"); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj b/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj index 2217894843..18ea09354c 100644 --- a/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj +++ b/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj @@ -51,5 +51,12 @@ NSwagCSharp /ClientClassAccessModifier:internal /GenerateExceptionClasses:false /AdditionalNamespaceUsages:JsonApiDotNetCore.OpenApi.Client.NSwag /GenerateNullableReferenceTypes:true + + OpenApiNSwagEndToEndTests.Links.GeneratedCode + LinksClient + LinksClient.cs + NSwagCSharp + /ClientClassAccessModifier:internal /GenerateExceptionClasses:false /AdditionalNamespaceUsages:JsonApiDotNetCore.OpenApi.Client.NSwag /GenerateNullableReferenceTypes:true + diff --git a/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json index bd633634be..24680ef3a9 100644 --- a/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json @@ -432,7 +432,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInErrorDocument" + "$ref": "#/components/schemas/errorTopLevelLinks" } ] }, @@ -470,6 +470,18 @@ }, "additionalProperties": false }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "gameAttributesInPostRequest": { "required": [ "title" @@ -540,7 +552,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -600,7 +612,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -634,69 +646,6 @@ "type": "string", "additionalProperties": false }, - "linksInErrorDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInRelationship": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceData": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, "playerAttributesInPostRequest": { "required": [ "userName" @@ -774,7 +723,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -863,7 +812,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -923,7 +872,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -1026,7 +975,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -1100,6 +1049,39 @@ "type": "string", "additionalProperties": false }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "toManyGameInRequest": { "required": [ "data" @@ -1116,15 +1098,12 @@ "additionalProperties": false }, "toManyGameInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -1160,15 +1139,12 @@ "additionalProperties": false }, "toManyPlayerGroupInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -1204,15 +1180,12 @@ "additionalProperties": false }, "toManyPlayerInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, diff --git a/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json index e662a9e091..c8e1735b6b 100644 --- a/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json @@ -1180,7 +1180,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -1288,7 +1288,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -1347,7 +1347,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -1516,7 +1516,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInErrorDocument" + "$ref": "#/components/schemas/errorTopLevelLinks" } ] }, @@ -1554,6 +1554,18 @@ }, "additionalProperties": false }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "languageAttributesInResponse": { "type": "object", "properties": { @@ -1576,7 +1588,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -1620,7 +1632,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -1664,7 +1676,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierCollectionDocument" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, @@ -1691,48 +1703,49 @@ "type": "string", "additionalProperties": false }, - "linksInErrorDocument": { - "required": [ - "self" - ], + "relationshipLinks": { "type": "object", "properties": { "self": { - "minLength": 1, "type": "string" }, - "describedby": { + "related": { "type": "string" } }, "additionalProperties": false }, - "linksInRelationship": { - "required": [ - "related", - "self" - ], + "resourceCollectionTopLevelLinks": { "type": "object", "properties": { "self": { - "minLength": 1, "type": "string" }, - "related": { - "minLength": 1, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { "type": "string" } }, "additionalProperties": false }, - "linksInResourceCollectionDocument": { - "required": [ - "self" - ], + "resourceIdentifierCollectionTopLevelLinks": { "type": "object", "properties": { "self": { - "minLength": 1, + "type": "string" + }, + "related": { "type": "string" }, "describedby": { @@ -1753,27 +1766,19 @@ }, "additionalProperties": false }, - "linksInResourceData": { - "required": [ - "self" - ], + "resourceLinks": { "type": "object", "properties": { "self": { - "minLength": 1, "type": "string" } }, "additionalProperties": false }, - "linksInResourceDocument": { - "required": [ - "self" - ], + "resourceTopLevelLinks": { "type": "object", "properties": { "self": { - "minLength": 1, "type": "string" }, "describedby": { @@ -1782,39 +1787,6 @@ }, "additionalProperties": false }, - "linksInResourceIdentifierCollectionDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, "toManyLanguageInRequest": { "required": [ "data" @@ -1831,15 +1803,12 @@ "additionalProperties": false }, "toManyLanguageInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, diff --git a/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json index d7fc51f676..2112a1cf5c 100644 --- a/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json @@ -5998,7 +5998,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-collection-document" + "$ref": "#/components/schemas/resource-collection-top-level-links" } ] }, @@ -6106,7 +6106,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-data" + "$ref": "#/components/schemas/resource-links" } ] }, @@ -6172,7 +6172,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -6358,7 +6358,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-error-document" + "$ref": "#/components/schemas/error-top-level-links" } ] }, @@ -6396,6 +6396,18 @@ }, "additionalProperties": false }, + "error-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "flight-attendant-attributes-in-patch-request": { "type": "object", "properties": { @@ -6480,7 +6492,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-collection-document" + "$ref": "#/components/schemas/resource-collection-top-level-links" } ] }, @@ -6588,7 +6600,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-data" + "$ref": "#/components/schemas/resource-links" } ] }, @@ -6639,7 +6651,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-identifier-collection-document" + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" } ] }, @@ -6676,7 +6688,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-identifier-document" + "$ref": "#/components/schemas/resource-identifier-top-level-links" } ] }, @@ -6746,7 +6758,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -6857,7 +6869,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -6961,7 +6973,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-collection-document" + "$ref": "#/components/schemas/resource-collection-top-level-links" } ] }, @@ -7062,7 +7074,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-data" + "$ref": "#/components/schemas/resource-links" } ] }, @@ -7113,7 +7125,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-identifier-collection-document" + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" } ] }, @@ -7182,7 +7194,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -7349,151 +7361,6 @@ }, "additionalProperties": false }, - "links-in-error-document": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-relationship": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-collection-document": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-data": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-document": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-identifier-collection-document": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-identifier-document": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, "nullable-flight-attendant-identifier-response-document": { "required": [ "data", @@ -7511,7 +7378,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-identifier-document" + "$ref": "#/components/schemas/resource-identifier-top-level-links" } ] }, @@ -7550,7 +7417,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -7596,15 +7463,12 @@ "additionalProperties": false }, "nullable-to-one-flight-attendant-in-response": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-relationship" + "$ref": "#/components/schemas/relationship-links" } ] }, @@ -7683,7 +7547,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-collection-document" + "$ref": "#/components/schemas/resource-collection-top-level-links" } ] }, @@ -7770,7 +7634,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-data" + "$ref": "#/components/schemas/resource-links" } ] }, @@ -7821,7 +7685,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-identifier-collection-document" + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" } ] }, @@ -7890,7 +7754,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -7924,6 +7788,105 @@ "type": "string", "additionalProperties": false }, + "relationship-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-collection-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-identifier-collection-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-identifier-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "to-many-flight-attendant-in-request": { "required": [ "data" @@ -7940,15 +7903,12 @@ "additionalProperties": false }, "to-many-flight-attendant-in-response": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-relationship" + "$ref": "#/components/schemas/relationship-links" } ] }, @@ -7984,15 +7944,12 @@ "additionalProperties": false }, "to-many-flight-in-response": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-relationship" + "$ref": "#/components/schemas/relationship-links" } ] }, @@ -8028,15 +7985,12 @@ "additionalProperties": false }, "to-many-passenger-in-response": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-relationship" + "$ref": "#/components/schemas/relationship-links" } ] }, @@ -8073,15 +8027,12 @@ "additionalProperties": false }, "to-one-flight-attendant-in-response": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-relationship" + "$ref": "#/components/schemas/relationship-links" } ] }, diff --git a/test/OpenApiTests/LegacyOpenApi/expected-swagger.json b/test/OpenApiTests/LegacyOpenApi/expected-swagger.json index d7fc51f676..2112a1cf5c 100644 --- a/test/OpenApiTests/LegacyOpenApi/expected-swagger.json +++ b/test/OpenApiTests/LegacyOpenApi/expected-swagger.json @@ -5998,7 +5998,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-collection-document" + "$ref": "#/components/schemas/resource-collection-top-level-links" } ] }, @@ -6106,7 +6106,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-data" + "$ref": "#/components/schemas/resource-links" } ] }, @@ -6172,7 +6172,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -6358,7 +6358,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-error-document" + "$ref": "#/components/schemas/error-top-level-links" } ] }, @@ -6396,6 +6396,18 @@ }, "additionalProperties": false }, + "error-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "flight-attendant-attributes-in-patch-request": { "type": "object", "properties": { @@ -6480,7 +6492,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-collection-document" + "$ref": "#/components/schemas/resource-collection-top-level-links" } ] }, @@ -6588,7 +6600,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-data" + "$ref": "#/components/schemas/resource-links" } ] }, @@ -6639,7 +6651,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-identifier-collection-document" + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" } ] }, @@ -6676,7 +6688,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-identifier-document" + "$ref": "#/components/schemas/resource-identifier-top-level-links" } ] }, @@ -6746,7 +6758,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -6857,7 +6869,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -6961,7 +6973,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-collection-document" + "$ref": "#/components/schemas/resource-collection-top-level-links" } ] }, @@ -7062,7 +7074,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-data" + "$ref": "#/components/schemas/resource-links" } ] }, @@ -7113,7 +7125,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-identifier-collection-document" + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" } ] }, @@ -7182,7 +7194,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -7349,151 +7361,6 @@ }, "additionalProperties": false }, - "links-in-error-document": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-relationship": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-collection-document": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-data": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-document": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-identifier-collection-document": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-identifier-document": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, "nullable-flight-attendant-identifier-response-document": { "required": [ "data", @@ -7511,7 +7378,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-identifier-document" + "$ref": "#/components/schemas/resource-identifier-top-level-links" } ] }, @@ -7550,7 +7417,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -7596,15 +7463,12 @@ "additionalProperties": false }, "nullable-to-one-flight-attendant-in-response": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-relationship" + "$ref": "#/components/schemas/relationship-links" } ] }, @@ -7683,7 +7547,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-collection-document" + "$ref": "#/components/schemas/resource-collection-top-level-links" } ] }, @@ -7770,7 +7634,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-data" + "$ref": "#/components/schemas/resource-links" } ] }, @@ -7821,7 +7685,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-identifier-collection-document" + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" } ] }, @@ -7890,7 +7754,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -7924,6 +7788,105 @@ "type": "string", "additionalProperties": false }, + "relationship-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-collection-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-identifier-collection-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-identifier-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "to-many-flight-attendant-in-request": { "required": [ "data" @@ -7940,15 +7903,12 @@ "additionalProperties": false }, "to-many-flight-attendant-in-response": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-relationship" + "$ref": "#/components/schemas/relationship-links" } ] }, @@ -7984,15 +7944,12 @@ "additionalProperties": false }, "to-many-flight-in-response": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-relationship" + "$ref": "#/components/schemas/relationship-links" } ] }, @@ -8028,15 +7985,12 @@ "additionalProperties": false }, "to-many-passenger-in-response": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-relationship" + "$ref": "#/components/schemas/relationship-links" } ] }, @@ -8073,15 +8027,12 @@ "additionalProperties": false }, "to-one-flight-attendant-in-response": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-relationship" + "$ref": "#/components/schemas/relationship-links" } ] }, diff --git a/test/OpenApiTests/Links/Accommodation.cs b/test/OpenApiTests/Links/Accommodation.cs new file mode 100644 index 0000000000..5a793da701 --- /dev/null +++ b/test/OpenApiTests/Links/Accommodation.cs @@ -0,0 +1,13 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.Links")] +public sealed class Accommodation : Identifiable +{ + [Attr] + public string Address { get; set; } = null!; +} diff --git a/test/OpenApiTests/Links/Disabled/LinksDisabledTests.cs b/test/OpenApiTests/Links/Disabled/LinksDisabledTests.cs new file mode 100644 index 0000000000..e992e3fd28 --- /dev/null +++ b/test/OpenApiTests/Links/Disabled/LinksDisabledTests.cs @@ -0,0 +1,117 @@ +using System.Text.Json; +using FluentAssertions; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Resources.Annotations; +using Microsoft.Extensions.DependencyInjection; +using TestBuildingBlocks; +using Xunit; + +namespace OpenApiTests.Links.Disabled; + +public sealed class LinksDisabledTests : IClassFixture, LinkDbContext>> +{ + private readonly OpenApiTestContext, LinkDbContext> _testContext; + + public LinksDisabledTests(OpenApiTestContext, LinkDbContext> testContext) + { + _testContext = testContext; + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService(); + options.TopLevelLinks = LinkTypes.None; + options.ResourceLinks = LinkTypes.NotConfigured; + options.RelationshipLinks = LinkTypes.None; + } + + [Theory] + [InlineData("resourceTopLevelLinks")] + [InlineData("resourceCollectionTopLevelLinks")] + [InlineData("resourceIdentifierTopLevelLinks")] + [InlineData("resourceIdentifierCollectionTopLevelLinks")] + [InlineData("errorTopLevelLinks")] + [InlineData("relationshipLinks")] + [InlineData("resourceLinks")] + public async Task All_configurable_link_schemas_are_hidden(string schemaId) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().NotContainPath(schemaId); + }); + } + + [Fact] + public async Task Error_links_schema_is_visible() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.errorLinks").With(linksElement => + { + linksElement.Should().NotContainPath("required"); + + linksElement.Should().ContainPath("properties").With(propertiesElement => + { + string[] linkPropertyNames = propertiesElement.EnumerateObject().Select(propertyElement => propertyElement.Name).ToArray(); + + linkPropertyNames.ShouldHaveCount(2); + linkPropertyNames[0].Should().Be("about"); + linkPropertyNames[1].Should().Be("type"); + }); + }); + } + + [Theory] + [InlineData("accommodationPrimaryResponseDocument")] + [InlineData("accommodationSecondaryResponseDocument")] + [InlineData("excursionPrimaryResponseDocument")] + [InlineData("transportPrimaryResponseDocument")] + [InlineData("nullableTransportSecondaryResponseDocument")] + [InlineData("vacationPrimaryResponseDocument")] + [InlineData("accommodationCollectionResponseDocument")] + [InlineData("excursionCollectionResponseDocument")] + [InlineData("transportCollectionResponseDocument")] + [InlineData("vacationCollectionResponseDocument")] + [InlineData("accommodationIdentifierResponseDocument")] + [InlineData("nullableTransportIdentifierResponseDocument")] + [InlineData("excursionIdentifierCollectionResponseDocument")] + [InlineData("errorResponseDocument")] + [InlineData("toOneAccommodationInResponse")] + [InlineData("toManyExcursionInResponse")] + [InlineData("nullableToOneTransportInResponse")] + [InlineData("accommodationDataInResponse.allOf[1]")] + [InlineData("excursionDataInResponse.allOf[1]")] + [InlineData("transportDataInResponse.allOf[1]")] + [InlineData("vacationDataInResponse.allOf[1]")] + public async Task All_container_schemas_contain_no_link_property(string containerSchemaId) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().ContainPath(containerSchemaId).With(containerElement => + { + if (containerElement.TryGetProperty("required", out JsonElement requiredElement)) + { + requiredElement.Should().NotContainArrayElement("links"); + } + else + { + containerElement.Should().NotContainPath("required"); + } + + containerElement.Should().NotContainPath("properties.links"); + }); + }); + } +} diff --git a/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..adcd8418ba --- /dev/null +++ b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json @@ -0,0 +1,5298 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/accommodations": { + "get": { + "tags": [ + "accommodations" + ], + "summary": "Retrieves a collection of accommodations.", + "operationId": "getAccommodationCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found accommodations, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/accommodationCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "accommodations" + ], + "summary": "Retrieves a collection of accommodations without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headAccommodationCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "accommodations" + ], + "summary": "Creates a new accommodation.", + "operationId": "postAccommodation", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the accommodation to create.", + "content": { + "application/vnd.api+json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationPostRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The accommodation was successfully created, which resulted in additional changes. The newly created accommodation is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created accommodation can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/accommodationPrimaryResponseDocument" + } + } + } + }, + "204": { + "description": "The accommodation was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/accommodations/{id}": { + "get": { + "tags": [ + "accommodations" + ], + "summary": "Retrieves an individual accommodation by its identifier.", + "operationId": "getAccommodation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the accommodation to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found accommodation.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/accommodationPrimaryResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The accommodation does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "accommodations" + ], + "summary": "Retrieves an individual accommodation by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headAccommodation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the accommodation to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The accommodation does not exist." + } + } + }, + "patch": { + "tags": [ + "accommodations" + ], + "summary": "Updates an existing accommodation.", + "operationId": "patchAccommodation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the accommodation to update.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the accommodation to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationPatchRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The accommodation was successfully updated, which resulted in additional changes. The updated accommodation is returned.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/accommodationPrimaryResponseDocument" + } + } + } + }, + "204": { + "description": "The accommodation was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The accommodation or a related resource does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "accommodations" + ], + "summary": "Deletes an existing accommodation by its identifier.", + "operationId": "deleteAccommodation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the accommodation to delete.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "The accommodation was successfully deleted." + }, + "404": { + "description": "The accommodation does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/excursions": { + "get": { + "tags": [ + "excursions" + ], + "summary": "Retrieves a collection of excursions.", + "operationId": "getExcursionCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found excursions, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/excursionCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "excursions" + ], + "summary": "Retrieves a collection of excursions without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headExcursionCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "excursions" + ], + "summary": "Creates a new excursion.", + "operationId": "postExcursion", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the excursion to create.", + "content": { + "application/vnd.api+json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/excursionPostRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The excursion was successfully created, which resulted in additional changes. The newly created excursion is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created excursion can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/excursionPrimaryResponseDocument" + } + } + } + }, + "204": { + "description": "The excursion was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/excursions/{id}": { + "get": { + "tags": [ + "excursions" + ], + "summary": "Retrieves an individual excursion by its identifier.", + "operationId": "getExcursion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the excursion to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found excursion.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/excursionPrimaryResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The excursion does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "excursions" + ], + "summary": "Retrieves an individual excursion by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headExcursion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the excursion to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The excursion does not exist." + } + } + }, + "patch": { + "tags": [ + "excursions" + ], + "summary": "Updates an existing excursion.", + "operationId": "patchExcursion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the excursion to update.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the excursion to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/excursionPatchRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The excursion was successfully updated, which resulted in additional changes. The updated excursion is returned.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/excursionPrimaryResponseDocument" + } + } + } + }, + "204": { + "description": "The excursion was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The excursion or a related resource does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "excursions" + ], + "summary": "Deletes an existing excursion by its identifier.", + "operationId": "deleteExcursion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the excursion to delete.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "The excursion was successfully deleted." + }, + "404": { + "description": "The excursion does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/transports": { + "get": { + "tags": [ + "transports" + ], + "summary": "Retrieves a collection of transports.", + "operationId": "getTransportCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found transports, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/transportCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "transports" + ], + "summary": "Retrieves a collection of transports without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTransportCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "transports" + ], + "summary": "Creates a new transport.", + "operationId": "postTransport", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the transport to create.", + "content": { + "application/vnd.api+json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/transportPostRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The transport was successfully created, which resulted in additional changes. The newly created transport is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created transport can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/transportPrimaryResponseDocument" + } + } + } + }, + "204": { + "description": "The transport was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/transports/{id}": { + "get": { + "tags": [ + "transports" + ], + "summary": "Retrieves an individual transport by its identifier.", + "operationId": "getTransport", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the transport to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found transport.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/transportPrimaryResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The transport does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "transports" + ], + "summary": "Retrieves an individual transport by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTransport", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the transport to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The transport does not exist." + } + } + }, + "patch": { + "tags": [ + "transports" + ], + "summary": "Updates an existing transport.", + "operationId": "patchTransport", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the transport to update.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the transport to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/transportPatchRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The transport was successfully updated, which resulted in additional changes. The updated transport is returned.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/transportPrimaryResponseDocument" + } + } + } + }, + "204": { + "description": "The transport was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The transport or a related resource does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "transports" + ], + "summary": "Deletes an existing transport by its identifier.", + "operationId": "deleteTransport", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the transport to delete.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "The transport was successfully deleted." + }, + "404": { + "description": "The transport does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/vacations": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves a collection of vacations.", + "operationId": "getVacationCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found vacations, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/vacationCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves a collection of vacations without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacationCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "vacations" + ], + "summary": "Creates a new vacation.", + "operationId": "postVacation", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the vacation to create.", + "content": { + "application/vnd.api+json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/vacationPostRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The vacation was successfully created, which resulted in additional changes. The newly created vacation is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created vacation can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/vacationPrimaryResponseDocument" + } + } + } + }, + "204": { + "description": "The vacation was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/vacations/{id}": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves an individual vacation by its identifier.", + "operationId": "getVacation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found vacation.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/vacationPrimaryResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves an individual vacation by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The vacation does not exist." + } + } + }, + "patch": { + "tags": [ + "vacations" + ], + "summary": "Updates an existing vacation.", + "operationId": "patchVacation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation to update.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the vacation to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/vacationPatchRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The vacation was successfully updated, which resulted in additional changes. The updated vacation is returned.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/vacationPrimaryResponseDocument" + } + } + } + }, + "204": { + "description": "The vacation was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation or a related resource does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "vacations" + ], + "summary": "Deletes an existing vacation by its identifier.", + "operationId": "deleteVacation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation to delete.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "The vacation was successfully deleted." + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/vacations/{id}/accommodation": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related accommodation of an individual vacation's accommodation relationship.", + "operationId": "getVacationAccommodation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related accommodation to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found accommodation, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/accommodationSecondaryResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related accommodation of an individual vacation's accommodation relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacationAccommodation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related accommodation to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The vacation does not exist." + } + } + } + }, + "/vacations/{id}/relationships/accommodation": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related accommodation identity of an individual vacation's accommodation relationship.", + "operationId": "getVacationAccommodationRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related accommodation identity to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found accommodation identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/accommodationIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related accommodation identity of an individual vacation's accommodation relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacationAccommodationRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related accommodation identity to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The vacation does not exist." + } + } + }, + "patch": { + "tags": [ + "vacations" + ], + "summary": "Assigns an existing accommodation to the accommodation relationship of an individual vacation.", + "operationId": "patchVacationAccommodationRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose accommodation relationship to assign.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identity of the accommodation to assign to the accommodation relationship.", + "content": { + "application/vnd.api+json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneAccommodationInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The accommodation relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation or a related resource does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/vacations/{id}/excursions": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related excursions of an individual vacation's excursions relationship.", + "operationId": "getVacationExcursions", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related excursions to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found excursions, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/excursionCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related excursions of an individual vacation's excursions relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacationExcursions", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related excursions to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The vacation does not exist." + } + } + } + }, + "/vacations/{id}/relationships/excursions": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related excursion identities of an individual vacation's excursions relationship.", + "operationId": "getVacationExcursionsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related excursion identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found excursion identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/excursionIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related excursion identities of an individual vacation's excursions relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacationExcursionsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related excursion identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The vacation does not exist." + } + } + }, + "post": { + "tags": [ + "vacations" + ], + "summary": "Adds existing excursions to the excursions relationship of an individual vacation.", + "operationId": "postVacationExcursionsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation to add excursions to.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the excursions to add to the excursions relationship.", + "content": { + "application/vnd.api+json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The excursions were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation or a related resource does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "vacations" + ], + "summary": "Assigns existing excursions to the excursions relationship of an individual vacation.", + "operationId": "patchVacationExcursionsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose excursions relationship to assign.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the excursions to assign to the excursions relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The excursions relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation or a related resource does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "vacations" + ], + "summary": "Removes existing excursions from the excursions relationship of an individual vacation.", + "operationId": "deleteVacationExcursionsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation to remove excursions from.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the excursions to remove from the excursions relationship.", + "content": { + "application/vnd.api+json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The excursions were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation or a related resource does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/vacations/{id}/transport": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related transport of an individual vacation's transport relationship.", + "operationId": "getVacationTransport", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related transport to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found transport, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/nullableTransportSecondaryResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related transport of an individual vacation's transport relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacationTransport", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related transport to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The vacation does not exist." + } + } + } + }, + "/vacations/{id}/relationships/transport": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related transport identity of an individual vacation's transport relationship.", + "operationId": "getVacationTransportRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related transport identity to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found transport identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/nullableTransportIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related transport identity of an individual vacation's transport relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacationTransportRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related transport identity to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The vacation does not exist." + } + } + }, + "patch": { + "tags": [ + "vacations" + ], + "summary": "Clears or assigns an existing transport to the transport relationship of an individual vacation.", + "operationId": "patchVacationTransportRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose transport relationship to assign or clear.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identity of the transport to assign to the transport relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTransportInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The transport relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation or a related resource does not exist.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "accommodationAttributesInPatchRequest": { + "type": "object", + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + }, + "accommodationAttributesInPostRequest": { + "required": [ + "address" + ], + "type": "object", + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + }, + "accommodationAttributesInResponse": { + "type": "object", + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + }, + "accommodationCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/accommodationDataInResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResponse" + } + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "accommodationDataInPatchRequest": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/accommodationResourceType" + }, + "id": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationAttributesInPatchRequest" + } + ] + } + }, + "additionalProperties": false + }, + "accommodationDataInPostRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/accommodationResourceType" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationAttributesInPostRequest" + } + ] + } + }, + "additionalProperties": false + }, + "accommodationDataInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResponse" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationAttributesInResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "accommodationIdentifier": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/accommodationResourceType" + }, + "id": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + }, + "accommodationIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationIdentifier" + } + ] + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "accommodationPatchRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationDataInPatchRequest" + } + ] + } + }, + "additionalProperties": false + }, + "accommodationPostRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationDataInPostRequest" + } + ] + } + }, + "additionalProperties": false + }, + "accommodationPrimaryResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationDataInResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResponse" + } + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "accommodationResourceType": { + "enum": [ + "accommodations" + ], + "type": "string", + "additionalProperties": false + }, + "accommodationSecondaryResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationDataInResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResponse" + } + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "dataInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "minLength": 1, + "type": "string" + }, + "id": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "accommodations": "#/components/schemas/accommodationDataInResponse", + "excursions": "#/components/schemas/excursionDataInResponse", + "transports": "#/components/schemas/transportDataInResponse", + "vacations": "#/components/schemas/vacationDataInResponse" + } + }, + "x-abstract": true + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "type": "object", + "additionalProperties": { }, + "nullable": true + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "excursionAttributesInPatchRequest": { + "type": "object", + "properties": { + "occursAt": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + }, + "excursionAttributesInPostRequest": { + "required": [ + "description", + "occursAt" + ], + "type": "object", + "properties": { + "occursAt": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + }, + "excursionAttributesInResponse": { + "type": "object", + "properties": { + "occursAt": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + }, + "excursionCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/excursionDataInResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResponse" + } + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "excursionDataInPatchRequest": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/excursionResourceType" + }, + "id": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/excursionAttributesInPatchRequest" + } + ] + } + }, + "additionalProperties": false + }, + "excursionDataInPostRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/excursionResourceType" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/excursionAttributesInPostRequest" + } + ] + } + }, + "additionalProperties": false + }, + "excursionDataInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResponse" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/excursionAttributesInResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "excursionIdentifier": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/excursionResourceType" + }, + "id": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + }, + "excursionIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/excursionIdentifier" + } + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "excursionPatchRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/excursionDataInPatchRequest" + } + ] + } + }, + "additionalProperties": false + }, + "excursionPostRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/excursionDataInPostRequest" + } + ] + } + }, + "additionalProperties": false + }, + "excursionPrimaryResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/excursionDataInResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResponse" + } + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "excursionResourceType": { + "enum": [ + "excursions" + ], + "type": "string", + "additionalProperties": false + }, + "nullableToOneTransportInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/transportIdentifier" + } + ], + "nullable": true + } + }, + "additionalProperties": false + }, + "nullableToOneTransportInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/transportIdentifier" + } + ], + "nullable": true + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "nullableTransportIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/transportIdentifier" + } + ], + "nullable": true + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "nullableTransportSecondaryResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/transportDataInResponse" + } + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResponse" + } + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "toManyExcursionInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/excursionIdentifier" + } + } + }, + "additionalProperties": false + }, + "toManyExcursionInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/excursionIdentifier" + } + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "toOneAccommodationInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationIdentifier" + } + ] + } + }, + "additionalProperties": false + }, + "toOneAccommodationInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationIdentifier" + } + ] + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "transportAttributesInPatchRequest": { + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/transportType" + } + ] + }, + "durationInMinutes": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + }, + "transportAttributesInPostRequest": { + "required": [ + "durationInMinutes", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/transportType" + } + ] + }, + "durationInMinutes": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + }, + "transportAttributesInResponse": { + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/transportType" + } + ] + }, + "durationInMinutes": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + }, + "transportCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/transportDataInResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResponse" + } + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "transportDataInPatchRequest": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/transportResourceType" + }, + "id": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/transportAttributesInPatchRequest" + } + ] + } + }, + "additionalProperties": false + }, + "transportDataInPostRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/transportResourceType" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/transportAttributesInPostRequest" + } + ] + } + }, + "additionalProperties": false + }, + "transportDataInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResponse" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/transportAttributesInResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "transportIdentifier": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/transportResourceType" + }, + "id": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + }, + "transportPatchRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/transportDataInPatchRequest" + } + ] + } + }, + "additionalProperties": false + }, + "transportPostRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/transportDataInPostRequest" + } + ] + } + }, + "additionalProperties": false + }, + "transportPrimaryResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/transportDataInResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResponse" + } + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "transportResourceType": { + "enum": [ + "transports" + ], + "type": "string", + "additionalProperties": false + }, + "transportType": { + "enum": [ + 0, + 1, + 2, + 3 + ], + "type": "integer", + "format": "int32" + }, + "vacationAttributesInPatchRequest": { + "type": "object", + "properties": { + "startsAt": { + "type": "string", + "format": "date-time" + }, + "endsAt": { + "type": "string", + "format": "date-time" + } + }, + "additionalProperties": false + }, + "vacationAttributesInPostRequest": { + "required": [ + "endsAt", + "startsAt" + ], + "type": "object", + "properties": { + "startsAt": { + "type": "string", + "format": "date-time" + }, + "endsAt": { + "type": "string", + "format": "date-time" + } + }, + "additionalProperties": false + }, + "vacationAttributesInResponse": { + "type": "object", + "properties": { + "startsAt": { + "type": "string", + "format": "date-time" + }, + "endsAt": { + "type": "string", + "format": "date-time" + } + }, + "additionalProperties": false + }, + "vacationCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/vacationDataInResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResponse" + } + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "vacationDataInPatchRequest": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/vacationResourceType" + }, + "id": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/vacationAttributesInPatchRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/vacationRelationshipsInPatchRequest" + } + ] + } + }, + "additionalProperties": false + }, + "vacationDataInPostRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/vacationResourceType" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/vacationAttributesInPostRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/vacationRelationshipsInPostRequest" + } + ] + } + }, + "additionalProperties": false + }, + "vacationDataInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResponse" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/vacationAttributesInResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/vacationRelationshipsInResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "vacationPatchRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/vacationDataInPatchRequest" + } + ] + } + }, + "additionalProperties": false + }, + "vacationPostRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/vacationDataInPostRequest" + } + ] + } + }, + "additionalProperties": false + }, + "vacationPrimaryResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/vacationDataInResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResponse" + } + }, + "meta": { + "type": "object", + "additionalProperties": { + "type": "object", + "nullable": true + } + } + }, + "additionalProperties": false + }, + "vacationRelationshipsInPatchRequest": { + "type": "object", + "properties": { + "accommodation": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneAccommodationInRequest" + } + ] + }, + "transport": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTransportInRequest" + } + ] + }, + "excursions": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInRequest" + } + ] + } + }, + "additionalProperties": false + }, + "vacationRelationshipsInPostRequest": { + "required": [ + "accommodation" + ], + "type": "object", + "properties": { + "accommodation": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneAccommodationInRequest" + } + ] + }, + "transport": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTransportInRequest" + } + ] + }, + "excursions": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInRequest" + } + ] + } + }, + "additionalProperties": false + }, + "vacationRelationshipsInResponse": { + "type": "object", + "properties": { + "accommodation": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneAccommodationInResponse" + } + ] + }, + "transport": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTransportInResponse" + } + ] + }, + "excursions": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInResponse" + } + ] + } + }, + "additionalProperties": false + }, + "vacationResourceType": { + "enum": [ + "vacations" + ], + "type": "string", + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/Links/Enabled/LinksEnabledTests.cs b/test/OpenApiTests/Links/Enabled/LinksEnabledTests.cs new file mode 100644 index 0000000000..b5291d6333 --- /dev/null +++ b/test/OpenApiTests/Links/Enabled/LinksEnabledTests.cs @@ -0,0 +1,111 @@ +using System.Text.Json; +using FluentAssertions; +using JsonApiDotNetCore.Resources.Annotations; +using TestBuildingBlocks; +using Xunit; + +namespace OpenApiTests.Links.Enabled; + +public sealed class LinksEnabledTests : IClassFixture, LinkDbContext>> +{ + private readonly OpenApiTestContext, LinkDbContext> _testContext; + + public LinksEnabledTests(OpenApiTestContext, LinkDbContext> testContext) + { + _testContext = testContext; + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Theory] + [InlineData("resourceTopLevelLinks", LinkTypes.Self | LinkTypes.DescribedBy)] + [InlineData("resourceCollectionTopLevelLinks", LinkTypes.Self | LinkTypes.DescribedBy | LinkTypes.Pagination)] + [InlineData("resourceIdentifierTopLevelLinks", LinkTypes.Self | LinkTypes.Related | LinkTypes.DescribedBy)] + [InlineData("resourceIdentifierCollectionTopLevelLinks", LinkTypes.Self | LinkTypes.Related | LinkTypes.DescribedBy | LinkTypes.Pagination)] + [InlineData("errorTopLevelLinks", LinkTypes.Self | LinkTypes.DescribedBy)] + [InlineData("relationshipLinks", LinkTypes.Self | LinkTypes.Related)] + [InlineData("resourceLinks", LinkTypes.Self)] + public async Task All_configurable_link_schemas_are_exposed(string schemaId, LinkTypes expected) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().ContainPath(schemaId).With(linksElement => + { + linksElement.Should().NotContainPath("required"); + + linksElement.Should().ContainPath("properties").With(propertiesElement => + { + string[] propertyNamesExpected = expected.ToPropertyNames().ToArray(); + string[] linkPropertyNames = propertiesElement.EnumerateObject().Select(propertyElement => propertyElement.Name).ToArray(); + + linkPropertyNames.Should().BeEquivalentTo(propertyNamesExpected); + }); + }); + }); + } + + [Theory] + [InlineData("resourceTopLevelLinks", "accommodationPrimaryResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "accommodationSecondaryResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "excursionPrimaryResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "transportPrimaryResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "nullableTransportSecondaryResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "vacationPrimaryResponseDocument", true)] + [InlineData("resourceCollectionTopLevelLinks", "accommodationCollectionResponseDocument", true)] + [InlineData("resourceCollectionTopLevelLinks", "excursionCollectionResponseDocument", true)] + [InlineData("resourceCollectionTopLevelLinks", "transportCollectionResponseDocument", true)] + [InlineData("resourceCollectionTopLevelLinks", "vacationCollectionResponseDocument", true)] + [InlineData("resourceIdentifierTopLevelLinks", "accommodationIdentifierResponseDocument", true)] + [InlineData("resourceIdentifierTopLevelLinks", "nullableTransportIdentifierResponseDocument", true)] + [InlineData("resourceIdentifierCollectionTopLevelLinks", "excursionIdentifierCollectionResponseDocument", true)] + [InlineData("errorTopLevelLinks", "errorResponseDocument", true)] + [InlineData("relationshipLinks", "toOneAccommodationInResponse", false)] + [InlineData("relationshipLinks", "toManyExcursionInResponse", false)] + [InlineData("relationshipLinks", "nullableToOneTransportInResponse", false)] + [InlineData("resourceLinks", "accommodationDataInResponse.allOf[1]", false)] + [InlineData("resourceLinks", "excursionDataInResponse.allOf[1]", false)] + [InlineData("resourceLinks", "transportDataInResponse.allOf[1]", false)] + [InlineData("resourceLinks", "vacationDataInResponse.allOf[1]", false)] + public async Task All_container_schemas_contain_correct_link_property(string linkSchemaId, string containerSchemaId, bool isRequired) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().ContainPath(containerSchemaId).With(containerElement => + { + if (isRequired) + { + containerElement.Should().ContainPath("required").With(requiredElement => + { + requiredElement.Should().ContainArrayElement("links"); + }); + } + else + { + if (containerElement.TryGetProperty("required", out JsonElement requiredElement)) + { + requiredElement.Should().NotContainArrayElement("links"); + } + else + { + containerElement.Should().NotContainPath("required"); + } + } + + containerElement.Should().ContainPath("properties.links.allOf[0].$ref").ShouldBeSchemaReferenceId(linkSchemaId); + }); + }); + } +} diff --git a/test/OpenApiTests/Links/Excursion.cs b/test/OpenApiTests/Links/Excursion.cs new file mode 100644 index 0000000000..92143cab73 --- /dev/null +++ b/test/OpenApiTests/Links/Excursion.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.Links")] +public sealed class Excursion : Identifiable +{ + [Attr] + [Required] + public DateTime? OccursAt { get; set; } + + [Attr] + public string Description { get; set; } = null!; +} diff --git a/test/OpenApiTests/Links/LinkDbContext.cs b/test/OpenApiTests/Links/LinkDbContext.cs new file mode 100644 index 0000000000..be573925a8 --- /dev/null +++ b/test/OpenApiTests/Links/LinkDbContext.cs @@ -0,0 +1,14 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using TestBuildingBlocks; + +namespace OpenApiTests.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class LinkDbContext(DbContextOptions options) : TestableDbContext(options) +{ + public DbSet Vacations => Set(); + public DbSet Accommodations => Set(); + public DbSet Transports => Set(); + public DbSet Excursions => Set(); +} diff --git a/test/OpenApiTests/Links/LinkFakers.cs b/test/OpenApiTests/Links/LinkFakers.cs new file mode 100644 index 0000000000..dada7dd354 --- /dev/null +++ b/test/OpenApiTests/Links/LinkFakers.cs @@ -0,0 +1,36 @@ +using Bogus; +using JetBrains.Annotations; +using TestBuildingBlocks; + +// @formatter:wrap_chained_method_calls chop_if_long +// @formatter:wrap_before_first_method_call true + +namespace OpenApiTests.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class LinkFakers : FakerContainer +{ + private readonly Lazy> _lazyVacationFaker = new(() => new Faker() + .UseSeed(GetFakerSeed()) + .RuleFor(vacation => vacation.StartsAt, faker => faker.Date.Future()) + .RuleFor(vacation => vacation.EndsAt, faker => faker.Date.Future())); + + private readonly Lazy> _lazyAccommodationFaker = new(() => new Faker() + .UseSeed(GetFakerSeed()) + .RuleFor(accommodation => accommodation.Address, faker => faker.Address.FullAddress())); + + private readonly Lazy> _lazyTransportFaker = new(() => new Faker() + .UseSeed(GetFakerSeed()) + .RuleFor(transport => transport.Type, faker => faker.PickRandom()) + .RuleFor(transport => transport.DurationInMinutes, faker => faker.Random.Int(30, 24 * 60))); + + private readonly Lazy> _lazyExcursionFaker = new(() => new Faker() + .UseSeed(GetFakerSeed()) + .RuleFor(excursion => excursion.OccursAt, faker => faker.Date.Future()) + .RuleFor(excursion => excursion.Description, faker => faker.Lorem.Sentence())); + + public Faker Vacation => _lazyVacationFaker.Value; + public Faker Accommodation => _lazyAccommodationFaker.Value; + public Faker Transport => _lazyTransportFaker.Value; + public Faker Excursion => _lazyExcursionFaker.Value; +} diff --git a/test/OpenApiTests/Links/LinkTypesExtensions.cs b/test/OpenApiTests/Links/LinkTypesExtensions.cs new file mode 100644 index 0000000000..192590b692 --- /dev/null +++ b/test/OpenApiTests/Links/LinkTypesExtensions.cs @@ -0,0 +1,32 @@ +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Links; + +internal static class LinkTypesExtensions +{ + public static IEnumerable ToPropertyNames(this LinkTypes linkTypes) + { + if (linkTypes.HasFlag(LinkTypes.Self)) + { + yield return "self"; + } + + if (linkTypes.HasFlag(LinkTypes.Related)) + { + yield return "related"; + } + + if (linkTypes.HasFlag(LinkTypes.DescribedBy)) + { + yield return "describedby"; + } + + if (linkTypes.HasFlag(LinkTypes.Pagination)) + { + yield return "first"; + yield return "last"; + yield return "prev"; + yield return "next"; + } + } +} diff --git a/test/OpenApiTests/Links/Mixed/LinksMixedTests.cs b/test/OpenApiTests/Links/Mixed/LinksMixedTests.cs new file mode 100644 index 0000000000..34b390b88a --- /dev/null +++ b/test/OpenApiTests/Links/Mixed/LinksMixedTests.cs @@ -0,0 +1,94 @@ +using System.Text.Json; +using FluentAssertions; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Resources.Annotations; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using TestBuildingBlocks; +using Xunit; + +namespace OpenApiTests.Links.Mixed; + +public sealed class LinksMixedTests : IClassFixture, LinkDbContext>> +{ + private readonly OpenApiTestContext, LinkDbContext> _testContext; + + public LinksMixedTests(OpenApiTestContext, LinkDbContext> testContext) + { + _testContext = testContext; + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.ConfigureServices(services => services.AddSingleton(CreateResourceGraph)); + + var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService(); + options.TopLevelLinks = LinkTypes.Pagination; + options.ResourceLinks = LinkTypes.NotConfigured; + options.RelationshipLinks = LinkTypes.None; + } + + [Theory] + [InlineData("resourceTopLevelLinks", LinkTypes.Self)] + [InlineData("resourceCollectionTopLevelLinks", LinkTypes.Self)] + [InlineData("resourceIdentifierTopLevelLinks", LinkTypes.Self | LinkTypes.Related)] + [InlineData("resourceIdentifierCollectionTopLevelLinks", LinkTypes.Self | LinkTypes.Related)] + [InlineData("errorTopLevelLinks", LinkTypes.Self)] + [InlineData("relationshipLinks", LinkTypes.Self | LinkTypes.Related)] + [InlineData("resourceLinks", LinkTypes.Self)] + public async Task Expected_configurable_link_schemas_are_exposed(string schemaId, LinkTypes expected) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().ContainPath(schemaId).With(linksElement => + { + linksElement.Should().NotContainPath("required"); + + linksElement.Should().ContainPath("properties").With(propertiesElement => + { + string[] propertyNamesExpected = expected.ToPropertyNames().ToArray(); + string[] linkPropertyNames = propertiesElement.EnumerateObject().Select(propertyElement => propertyElement.Name).ToArray(); + + linkPropertyNames.Should().BeEquivalentTo(propertyNamesExpected); + }); + }); + }); + } + + private static IResourceGraph CreateResourceGraph(IServiceProvider serviceProvider) + { + ResourceGraphBuilder builder = CreateResourceGraphBuilder(serviceProvider); + var editor = new ResourceGraphEditor(builder); + + editor.ChangeLinksInResourceType(typeof(Vacation), LinkTypes.None, null, null); + editor.ChangeLinkInRelationship(typeof(Vacation), nameof(Vacation.Transport), LinkTypes.Related); + + editor.ChangeLinksInResourceType(typeof(Accommodation), LinkTypes.Self, LinkTypes.Self, null); + + editor.ChangeLinksInResourceType(typeof(Transport), LinkTypes.Related, LinkTypes.Self, LinkTypes.Self); + + editor.ChangeLinksInResourceType(typeof(Excursion), LinkTypes.None, null, LinkTypes.None); + + return editor.GetResourceGraph(); + } + + private static ResourceGraphBuilder CreateResourceGraphBuilder(IServiceProvider serviceProvider) + { + var options = serviceProvider.GetRequiredService(); + var loggerFactory = serviceProvider.GetRequiredService(); + + using IServiceScope scope = serviceProvider.CreateScope(); + var dbContext = scope.ServiceProvider.GetRequiredService(); + + var builder = new ResourceGraphBuilder(options, loggerFactory); + builder.Add(dbContext); + + return builder; + } +} diff --git a/test/OpenApiTests/Links/Mixed/ResourceGraphEditor.cs b/test/OpenApiTests/Links/Mixed/ResourceGraphEditor.cs new file mode 100644 index 0000000000..5a2f19cfa7 --- /dev/null +++ b/test/OpenApiTests/Links/Mixed/ResourceGraphEditor.cs @@ -0,0 +1,41 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Links.Mixed; + +/// +/// Enables changing declared links on resource types and relationships, so the model does not need to be duplicated for testing. +/// +internal sealed class ResourceGraphEditor +{ + private readonly Dictionary _resourceTypesByClrTypeName; + + public ResourceGraphEditor(ResourceGraphBuilder builder) + { + IResourceGraph resourceGraph = builder.Build(); + _resourceTypesByClrTypeName = resourceGraph.GetResourceTypes().ToDictionary(resourceType => resourceType.ClrType, resourceType => resourceType); + } + + public void ChangeLinksInResourceType(Type resourceClrType, LinkTypes? topLevelLinks, LinkTypes? resourceLinks, LinkTypes? relationshipLinks) + { + ResourceType resourceType = _resourceTypesByClrTypeName[resourceClrType]; + + _resourceTypesByClrTypeName[resourceClrType] = new ResourceType(resourceType.PublicName, resourceType.ClientIdGeneration, resourceType.ClrType, + resourceType.IdentityClrType, resourceType.Attributes, resourceType.Relationships, resourceType.EagerLoads, + topLevelLinks ?? resourceType.TopLevelLinks, resourceLinks ?? resourceType.ResourceLinks, relationshipLinks ?? resourceType.RelationshipLinks); + } + + public void ChangeLinkInRelationship(Type resourceClrType, string relationshipPropertyName, LinkTypes links) + { + ResourceType resourceType = _resourceTypesByClrTypeName[resourceClrType]; + + RelationshipAttribute relationship = resourceType.GetRelationshipByPropertyName(relationshipPropertyName); + relationship.Links = links; + } + + public IResourceGraph GetResourceGraph() + { + HashSet resourceTypeSet = _resourceTypesByClrTypeName.Values.ToHashSet(); + return new ResourceGraph(resourceTypeSet); + } +} diff --git a/test/OpenApiTests/Links/Transport.cs b/test/OpenApiTests/Links/Transport.cs new file mode 100644 index 0000000000..dda6021f0b --- /dev/null +++ b/test/OpenApiTests/Links/Transport.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.Links")] +public sealed class Transport : Identifiable +{ + [Attr] + [Required] + public TransportType? Type { get; set; } + + [Attr] + [Required] + public int? DurationInMinutes { get; set; } +} diff --git a/test/OpenApiTests/Links/TransportType.cs b/test/OpenApiTests/Links/TransportType.cs new file mode 100644 index 0000000000..6f1bbf9ea7 --- /dev/null +++ b/test/OpenApiTests/Links/TransportType.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; + +namespace OpenApiTests.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public enum TransportType +{ + Airplane, + Train, + Bus, + Boat +} diff --git a/test/OpenApiTests/Links/Vacation.cs b/test/OpenApiTests/Links/Vacation.cs new file mode 100644 index 0000000000..df592a4423 --- /dev/null +++ b/test/OpenApiTests/Links/Vacation.cs @@ -0,0 +1,28 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.Links")] +public sealed class Vacation : Identifiable +{ + [Attr] + [Required] + public DateTime? StartsAt { get; set; } + + [Attr] + [Required] + public DateTime? EndsAt { get; set; } + + [HasOne] + public Accommodation Accommodation { get; set; } = null!; + + [HasOne] + public Transport? Transport { get; set; } + + [HasMany] + public ISet Excursions { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs b/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs index 12228c8175..654b5b350b 100644 --- a/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs +++ b/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs @@ -40,21 +40,21 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() document.Should().ContainPath("components.schemas").With(schemasElement => { - string? linksInResourceCollectionDocumentSchemaRefId = null; + string? topLevelLinksSchemaRefId = null; string? resourceDataSchemaRefId = null; schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainPath("jsonapi.allOf[0].$ref").ShouldBeSchemaReferenceId("jsonapi"); - linksInResourceCollectionDocumentSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") - .ShouldBeSchemaReferenceId("linksInResourceCollectionDocument").SchemaReferenceId; + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("resourceCollectionTopLevelLinks").SchemaReferenceId; resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("supermarketDataInResponse") .SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceCollectionDocumentSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("describedby"); @@ -64,7 +64,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() propertiesElement.Should().ContainProperty("next"); }); - string? linksInResourceDataSchemaRefId = null; + string? resourceLinksSchemaRefId = null; string? resourceAttributesInResponseSchemaRefId = null; string? resourceRelationshipInResponseSchemaRefId = null; @@ -79,7 +79,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => { - linksInResourceDataSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("linksInResourceData") + resourceLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("resourceLinks") .SchemaReferenceId; resourceAttributesInResponseSchemaRefId = propertiesElement.Should().ContainPath("attributes.allOf[0].$ref") @@ -89,7 +89,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() .ShouldBeSchemaReferenceId("supermarketRelationshipsInResponse").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceDataSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); }); @@ -116,19 +116,19 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() propertiesElement.Should().ContainPath("cashiers.allOf[0].$ref").ShouldBeSchemaReferenceId("toManyStaffMemberInResponse"); }); - string? linksInRelationshipSchemaRefId = null; + string? relationshipLinksSchemaRefId = null; string? relatedResourceIdentifierSchemaRefId = null; schemasElement.Should().ContainPath($"{nullableToOneResourceResponseDataSchemaRefId}.properties").With(propertiesElement => { - linksInRelationshipSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("linksInRelationship") + relationshipLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("relationshipLinks") .SchemaReferenceId; relatedResourceIdentifierSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref") .ShouldBeSchemaReferenceId("staffMemberIdentifier").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInRelationshipSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{relationshipLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("related"); @@ -171,15 +171,15 @@ public async Task Casing_convention_is_applied_to_GetSingle_endpoint() document.Should().ContainPath("components.schemas").With(schemasElement => { - string? linksInResourceDocumentSchemaRefId = null; + string? topLevelLinksSchemaRefId = null; schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { - linksInResourceDocumentSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") - .ShouldBeSchemaReferenceId("linksInResourceDocument").SchemaReferenceId; + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("resourceTopLevelLinks") + .SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceDocumentSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("describedby"); @@ -284,15 +284,15 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ document.Should().ContainPath("components.schemas").With(schemasElement => { - string? linksInResourceIdentifierDocumentSchemaRefId = null; + string? topLevelLinksSchemaRefId = null; schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { - linksInResourceIdentifierDocumentSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") - .ShouldBeSchemaReferenceId("linksInResourceIdentifierDocument").SchemaReferenceId; + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("resourceIdentifierTopLevelLinks").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceIdentifierDocumentSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("describedby"); @@ -342,15 +342,15 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ document.Should().ContainPath("components.schemas").With(schemasElement => { - string? linksInResourceIdentifierCollectionDocumentSchemaRefId = null; + string? topLevelLinksSchemaRefId = null; schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { - linksInResourceIdentifierCollectionDocumentSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") - .ShouldBeSchemaReferenceId("linksInResourceIdentifierCollectionDocument").SchemaReferenceId; + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("resourceIdentifierCollectionTopLevelLinks").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceIdentifierCollectionDocumentSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("describedby"); @@ -559,6 +559,6 @@ public async Task Casing_convention_is_applied_to_error_schema() // Assert document.Should().ContainPath("components.schemas.errorResponseDocument"); - document.Should().ContainPath("components.schemas.linksInErrorDocument"); + document.Should().ContainPath("components.schemas.errorTopLevelLinks"); } } diff --git a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json index e401b02fc8..3fae1e7323 100644 --- a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json @@ -2626,7 +2626,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInErrorDocument" + "$ref": "#/components/schemas/errorTopLevelLinks" } ] }, @@ -2664,6 +2664,18 @@ }, "additionalProperties": false }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "jsonapi": { "type": "object", "properties": { @@ -2692,151 +2704,6 @@ }, "additionalProperties": false }, - "linksInErrorDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInRelationship": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceCollectionDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceData": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierCollectionDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, "nullableStaffMemberIdentifierResponseDocument": { "required": [ "data", @@ -2854,7 +2721,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -2893,7 +2760,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -2939,15 +2806,12 @@ "additionalProperties": false }, "nullableToOneStaffMemberInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -2969,6 +2833,105 @@ }, "additionalProperties": false }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "staffMemberAttributesInPatchRequest": { "type": "object", "properties": { @@ -3028,7 +2991,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -3115,7 +3078,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -3166,7 +3129,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierCollectionDocument" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, @@ -3203,7 +3166,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -3273,7 +3236,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -3324,7 +3287,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -3419,7 +3382,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -3527,7 +3490,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -3593,7 +3556,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -3735,15 +3698,12 @@ "additionalProperties": false }, "toManyStaffMemberInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -3780,15 +3740,12 @@ "additionalProperties": false }, "toOneStaffMemberInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, diff --git a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json index d2667bfc59..f3ee10e406 100644 --- a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json @@ -2626,7 +2626,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-error-document" + "$ref": "#/components/schemas/error-top-level-links" } ] }, @@ -2664,6 +2664,18 @@ }, "additionalProperties": false }, + "error-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "jsonapi": { "type": "object", "properties": { @@ -2692,151 +2704,6 @@ }, "additionalProperties": false }, - "links-in-error-document": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-relationship": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-collection-document": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-data": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-document": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-identifier-collection-document": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "links-in-resource-identifier-document": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, "nullable-staff-member-identifier-response-document": { "required": [ "data", @@ -2854,7 +2721,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-identifier-document" + "$ref": "#/components/schemas/resource-identifier-top-level-links" } ] }, @@ -2893,7 +2760,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -2939,15 +2806,12 @@ "additionalProperties": false }, "nullable-to-one-staff-member-in-response": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-relationship" + "$ref": "#/components/schemas/relationship-links" } ] }, @@ -2969,6 +2833,105 @@ }, "additionalProperties": false }, + "relationship-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-collection-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-identifier-collection-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-identifier-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "staff-member-attributes-in-patch-request": { "type": "object", "properties": { @@ -3028,7 +2991,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-collection-document" + "$ref": "#/components/schemas/resource-collection-top-level-links" } ] }, @@ -3115,7 +3078,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-data" + "$ref": "#/components/schemas/resource-links" } ] }, @@ -3166,7 +3129,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-identifier-collection-document" + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" } ] }, @@ -3203,7 +3166,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-identifier-document" + "$ref": "#/components/schemas/resource-identifier-top-level-links" } ] }, @@ -3273,7 +3236,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -3324,7 +3287,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -3419,7 +3382,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-collection-document" + "$ref": "#/components/schemas/resource-collection-top-level-links" } ] }, @@ -3527,7 +3490,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-data" + "$ref": "#/components/schemas/resource-links" } ] }, @@ -3593,7 +3556,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-resource-document" + "$ref": "#/components/schemas/resource-top-level-links" } ] }, @@ -3735,15 +3698,12 @@ "additionalProperties": false }, "to-many-staff-member-in-response": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-relationship" + "$ref": "#/components/schemas/relationship-links" } ] }, @@ -3780,15 +3740,12 @@ "additionalProperties": false }, "to-one-staff-member-in-response": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/links-in-relationship" + "$ref": "#/components/schemas/relationship-links" } ] }, diff --git a/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs b/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs index 9bf498941f..8962a56db6 100644 --- a/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs +++ b/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs @@ -40,21 +40,21 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() document.Should().ContainPath("components.schemas").With(schemasElement => { - string? linksInResourceCollectionDocumentSchemaRefId = null; + string? topLevelLinksSchemaRefId = null; string? resourceDataSchemaRefId = null; schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainPath("jsonapi.allOf[0].$ref").ShouldBeSchemaReferenceId("jsonapi"); - linksInResourceCollectionDocumentSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") - .ShouldBeSchemaReferenceId("links-in-resource-collection-document").SchemaReferenceId; + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("resource-collection-top-level-links").SchemaReferenceId; resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("supermarket-data-in-response") .SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceCollectionDocumentSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("describedby"); @@ -64,7 +64,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() propertiesElement.Should().ContainProperty("next"); }); - string? linksInResourceDataSchemaRefId = null; + string? resourceLinksSchemaRefId = null; string? resourceAttributesInResponseSchemaRefId = null; string? resourceRelationshipInResponseSchemaRefId = null; @@ -79,8 +79,8 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => { - linksInResourceDataSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") - .ShouldBeSchemaReferenceId("links-in-resource-data").SchemaReferenceId; + resourceLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("resource-links") + .SchemaReferenceId; resourceAttributesInResponseSchemaRefId = propertiesElement.Should().ContainPath("attributes.allOf[0].$ref") .ShouldBeSchemaReferenceId("supermarket-attributes-in-response").SchemaReferenceId; @@ -89,7 +89,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() .ShouldBeSchemaReferenceId("supermarket-relationships-in-response").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceDataSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); }); @@ -116,19 +116,19 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() propertiesElement.Should().ContainPath("cashiers.allOf[0].$ref").ShouldBeSchemaReferenceId("to-many-staff-member-in-response"); }); - string? linksInRelationshipSchemaRefId = null; + string? relationshipLinksSchemaRefId = null; string? relatedResourceIdentifierSchemaRefId = null; schemasElement.Should().ContainPath($"{nullableToOneResourceResponseDataSchemaRefId}.properties").With(propertiesElement => { - linksInRelationshipSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") - .ShouldBeSchemaReferenceId("links-in-relationship").SchemaReferenceId; + relationshipLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("relationship-links") + .SchemaReferenceId; relatedResourceIdentifierSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref") .ShouldBeSchemaReferenceId("staff-member-identifier").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInRelationshipSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{relationshipLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("related"); @@ -171,15 +171,15 @@ public async Task Casing_convention_is_applied_to_GetSingle_endpoint() document.Should().ContainPath("components.schemas").With(schemasElement => { - string? linksInResourceDocumentSchemaRefId = null; + string? topLevelLinksSchemaRefId = null; schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { - linksInResourceDocumentSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") - .ShouldBeSchemaReferenceId("links-in-resource-document").SchemaReferenceId; + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("resource-top-level-links") + .SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceDocumentSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("describedby"); @@ -284,15 +284,15 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ document.Should().ContainPath("components.schemas").With(schemasElement => { - string? linksInResourceIdentifierDocumentSchemaRefId = null; + string? topLevelLinksSchemaRefId = null; schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { - linksInResourceIdentifierDocumentSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") - .ShouldBeSchemaReferenceId("links-in-resource-identifier-document").SchemaReferenceId; + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("resource-identifier-top-level-links").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceIdentifierDocumentSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("describedby"); @@ -342,15 +342,15 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ document.Should().ContainPath("components.schemas").With(schemasElement => { - string? linksInResourceIdentifierCollectionDocumentSchemaRefId = null; + string? topLevelLinksSchemaRefId = null; schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { - linksInResourceIdentifierCollectionDocumentSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") - .ShouldBeSchemaReferenceId("links-in-resource-identifier-collection-document").SchemaReferenceId; + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("resource-identifier-collection-top-level-links").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceIdentifierCollectionDocumentSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("describedby"); @@ -561,6 +561,6 @@ public async Task Casing_convention_is_applied_to_error_schema() // Assert document.Should().ContainPath("components.schemas.error-response-document"); - document.Should().ContainPath("components.schemas.links-in-error-document"); + document.Should().ContainPath("components.schemas.error-top-level-links"); } } diff --git a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json index 525d72722b..cbbd39fce4 100644 --- a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json @@ -2626,7 +2626,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInErrorDocument" + "$ref": "#/components/schemas/ErrorTopLevelLinks" } ] }, @@ -2664,6 +2664,18 @@ }, "additionalProperties": false }, + "ErrorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "Jsonapi": { "type": "object", "properties": { @@ -2692,151 +2704,6 @@ }, "additionalProperties": false }, - "LinksInErrorDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "LinksInRelationship": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "LinksInResourceCollectionDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "LinksInResourceData": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "LinksInResourceDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "LinksInResourceIdentifierCollectionDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "LinksInResourceIdentifierDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, "NullableStaffMemberIdentifierResponseDocument": { "required": [ "data", @@ -2854,7 +2721,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInResourceIdentifierDocument" + "$ref": "#/components/schemas/ResourceIdentifierTopLevelLinks" } ] }, @@ -2893,7 +2760,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInResourceDocument" + "$ref": "#/components/schemas/ResourceTopLevelLinks" } ] }, @@ -2939,15 +2806,12 @@ "additionalProperties": false }, "NullableToOneStaffMemberInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInRelationship" + "$ref": "#/components/schemas/RelationshipLinks" } ] }, @@ -2969,6 +2833,105 @@ }, "additionalProperties": false }, + "RelationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ResourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ResourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ResourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ResourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ResourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "StaffMemberAttributesInPatchRequest": { "type": "object", "properties": { @@ -3028,7 +2991,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInResourceCollectionDocument" + "$ref": "#/components/schemas/ResourceCollectionTopLevelLinks" } ] }, @@ -3115,7 +3078,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInResourceData" + "$ref": "#/components/schemas/ResourceLinks" } ] }, @@ -3166,7 +3129,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInResourceIdentifierCollectionDocument" + "$ref": "#/components/schemas/ResourceIdentifierCollectionTopLevelLinks" } ] }, @@ -3203,7 +3166,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInResourceIdentifierDocument" + "$ref": "#/components/schemas/ResourceIdentifierTopLevelLinks" } ] }, @@ -3273,7 +3236,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInResourceDocument" + "$ref": "#/components/schemas/ResourceTopLevelLinks" } ] }, @@ -3324,7 +3287,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInResourceDocument" + "$ref": "#/components/schemas/ResourceTopLevelLinks" } ] }, @@ -3419,7 +3382,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInResourceCollectionDocument" + "$ref": "#/components/schemas/ResourceCollectionTopLevelLinks" } ] }, @@ -3527,7 +3490,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInResourceData" + "$ref": "#/components/schemas/ResourceLinks" } ] }, @@ -3593,7 +3556,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInResourceDocument" + "$ref": "#/components/schemas/ResourceTopLevelLinks" } ] }, @@ -3735,15 +3698,12 @@ "additionalProperties": false }, "ToManyStaffMemberInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInRelationship" + "$ref": "#/components/schemas/RelationshipLinks" } ] }, @@ -3780,15 +3740,12 @@ "additionalProperties": false }, "ToOneStaffMemberInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/LinksInRelationship" + "$ref": "#/components/schemas/RelationshipLinks" } ] }, diff --git a/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs b/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs index f2a26415cd..3646ff225a 100644 --- a/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs +++ b/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs @@ -40,21 +40,21 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() document.Should().ContainPath("components.schemas").With(schemasElement => { - string? linksInResourceCollectionDocumentSchemaRefId = null; + string? topLevelLinksSchemaRefId = null; string? resourceDataSchemaRefId = null; schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainPath("jsonapi.allOf[0].$ref").ShouldBeSchemaReferenceId("Jsonapi"); - linksInResourceCollectionDocumentSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") - .ShouldBeSchemaReferenceId("LinksInResourceCollectionDocument").SchemaReferenceId; + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("ResourceCollectionTopLevelLinks").SchemaReferenceId; resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("SupermarketDataInResponse") .SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceCollectionDocumentSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("describedby"); @@ -64,7 +64,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() propertiesElement.Should().ContainProperty("next"); }); - string? linksInResourceDataSchemaRefId = null; + string? resourceLinksSchemaRefId = null; string? resourceAttributesInResponseSchemaRefId = null; string? resourceRelationshipInResponseSchemaRefId = null; @@ -79,7 +79,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => { - linksInResourceDataSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("LinksInResourceData") + resourceLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("ResourceLinks") .SchemaReferenceId; resourceAttributesInResponseSchemaRefId = propertiesElement.Should().ContainPath("attributes.allOf[0].$ref") @@ -89,7 +89,7 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() .ShouldBeSchemaReferenceId("SupermarketRelationshipsInResponse").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceDataSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{resourceLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); }); @@ -116,19 +116,19 @@ public async Task Casing_convention_is_applied_to_GetCollection_endpoint() propertiesElement.Should().ContainPath("Cashiers.allOf[0].$ref").ShouldBeSchemaReferenceId("ToManyStaffMemberInResponse"); }); - string? linksInRelationshipSchemaRefId = null; + string? relationshipLinksSchemaRefId = null; string? relatedResourceIdentifierSchemaRefId = null; schemasElement.Should().ContainPath($"{nullableToOneResourceResponseDataSchemaRefId}.properties").With(propertiesElement => { - linksInRelationshipSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("LinksInRelationship") + relationshipLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("RelationshipLinks") .SchemaReferenceId; relatedResourceIdentifierSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref") .ShouldBeSchemaReferenceId("StaffMemberIdentifier").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInRelationshipSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{relationshipLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("related"); @@ -171,15 +171,15 @@ public async Task Casing_convention_is_applied_to_GetSingle_endpoint() document.Should().ContainPath("components.schemas").With(schemasElement => { - string? linksInResourceDocumentSchemaRefId = null; + string? topLevelLinksSchemaRefId = null; schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { - linksInResourceDocumentSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") - .ShouldBeSchemaReferenceId("LinksInResourceDocument").SchemaReferenceId; + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("ResourceTopLevelLinks") + .SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceDocumentSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("describedby"); @@ -284,15 +284,15 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ document.Should().ContainPath("components.schemas").With(schemasElement => { - string? linksInResourceIdentifierDocumentSchemaRefId = null; + string? topLevelLinksSchemaRefId = null; schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { - linksInResourceIdentifierDocumentSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") - .ShouldBeSchemaReferenceId("LinksInResourceIdentifierDocument").SchemaReferenceId; + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("ResourceIdentifierTopLevelLinks").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceIdentifierDocumentSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("describedby"); @@ -342,15 +342,15 @@ public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ document.Should().ContainPath("components.schemas").With(schemasElement => { - string? linksInResourceIdentifierCollectionDocumentSchemaRefId = null; + string? topLevelLinksSchemaRefId = null; schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => { - linksInResourceIdentifierCollectionDocumentSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") - .ShouldBeSchemaReferenceId("LinksInResourceIdentifierCollectionDocument").SchemaReferenceId; + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("ResourceIdentifierCollectionTopLevelLinks").SchemaReferenceId; }); - schemasElement.Should().ContainPath($"{linksInResourceIdentifierCollectionDocumentSchemaRefId}.properties").With(propertiesElement => + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => { propertiesElement.Should().ContainProperty("self"); propertiesElement.Should().ContainProperty("describedby"); @@ -559,6 +559,6 @@ public async Task Casing_convention_is_applied_to_error_schema() // Assert document.Should().ContainPath("components.schemas.ErrorResponseDocument"); - document.Should().ContainPath("components.schemas.LinksInErrorDocument"); + document.Should().ContainPath("components.schemas.ErrorTopLevelLinks"); } } diff --git a/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json index dda7bdd0d4..54ad046fdc 100644 --- a/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json @@ -3171,7 +3171,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInErrorDocument" + "$ref": "#/components/schemas/errorTopLevelLinks" } ] }, @@ -3209,143 +3209,10 @@ }, "additionalProperties": false }, - "linksInErrorDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInRelationship": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceCollectionDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceData": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierCollectionDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierDocument": { - "required": [ - "related", - "self" - ], + "errorTopLevelLinks": { "type": "object", "properties": { "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, "type": "string" }, "describedby": { @@ -3406,7 +3273,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -3514,7 +3381,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -3558,7 +3425,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierCollectionDocument" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, @@ -3620,7 +3487,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -3748,7 +3615,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -3856,7 +3723,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -3900,7 +3767,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierCollectionDocument" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, @@ -3930,7 +3797,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -3993,7 +3860,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -4118,7 +3985,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -4155,7 +4022,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -4187,7 +4054,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -4233,15 +4100,12 @@ "additionalProperties": false }, "nullableToOneNodeInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -4263,6 +4127,105 @@ }, "additionalProperties": false }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "toManyNameValuePairInRequest": { "required": [ "data" @@ -4279,15 +4242,12 @@ "additionalProperties": false }, "toManyNameValuePairInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -4323,15 +4283,12 @@ "additionalProperties": false }, "toManyNodeInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -4368,15 +4325,12 @@ "additionalProperties": false }, "toOneNodeInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json index 0b4d36d5cb..f3714fc69b 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json @@ -2548,7 +2548,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -2585,7 +2585,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -2629,7 +2629,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierCollectionDocument" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, @@ -2726,7 +2726,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInErrorDocument" + "$ref": "#/components/schemas/errorTopLevelLinks" } ] }, @@ -2764,143 +2764,10 @@ }, "additionalProperties": false }, - "linksInErrorDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInRelationship": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceCollectionDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceData": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierCollectionDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierDocument": { - "required": [ - "related", - "self" - ], + "errorTopLevelLinks": { "type": "object", "properties": { "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, "type": "string" }, "describedby": { @@ -2919,7 +2786,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -2951,7 +2818,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -2997,15 +2864,12 @@ "additionalProperties": false }, "nullableToOneEmptyInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -3027,6 +2891,18 @@ }, "additionalProperties": false }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, "resourceAttributesInPatchRequest": { "type": "object", "properties": { @@ -3141,7 +3017,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -3167,6 +3043,30 @@ }, "additionalProperties": false }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, "resourceDataInPatchRequest": { "required": [ "id", @@ -3249,7 +3149,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -3266,6 +3166,57 @@ ], "additionalProperties": false }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, "resourcePatchRequestDocument": { "required": [ "data" @@ -3308,7 +3259,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -3448,6 +3399,18 @@ "type": "string", "additionalProperties": false }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "toManyEmptyInRequest": { "required": [ "data" @@ -3464,15 +3427,12 @@ "additionalProperties": false }, "toManyEmptyInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json index 2e672ba839..a395b78d1d 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json @@ -2548,7 +2548,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -2585,7 +2585,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -2629,7 +2629,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierCollectionDocument" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, @@ -2659,7 +2659,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -2697,7 +2697,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -2794,7 +2794,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInErrorDocument" + "$ref": "#/components/schemas/errorTopLevelLinks" } ] }, @@ -2832,143 +2832,10 @@ }, "additionalProperties": false }, - "linksInErrorDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInRelationship": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceCollectionDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceData": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceDocument": { - "required": [ - "self" - ], + "errorTopLevelLinks": { "type": "object", "properties": { "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierCollectionDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, "type": "string" }, "describedby": { @@ -2987,7 +2854,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -3019,7 +2886,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -3065,15 +2932,12 @@ "additionalProperties": false }, "nullableToOneEmptyInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -3095,6 +2959,18 @@ }, "additionalProperties": false }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, "resourceAttributesInPatchRequest": { "type": "object", "properties": { @@ -3202,7 +3078,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -3228,6 +3104,30 @@ }, "additionalProperties": false }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, "resourceDataInPatchRequest": { "required": [ "id", @@ -3310,7 +3210,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -3327,6 +3227,57 @@ ], "additionalProperties": false }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, "resourcePatchRequestDocument": { "required": [ "data" @@ -3369,7 +3320,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -3508,6 +3459,18 @@ "type": "string", "additionalProperties": false }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "toManyEmptyInRequest": { "required": [ "data" @@ -3524,15 +3487,12 @@ "additionalProperties": false }, "toManyEmptyInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -3569,15 +3529,12 @@ "additionalProperties": false }, "toOneEmptyInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json index 9fb09e388e..e2943dc939 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json @@ -3380,7 +3380,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -3417,7 +3417,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -3461,7 +3461,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierCollectionDocument" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, @@ -3491,7 +3491,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -3529,7 +3529,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -3626,7 +3626,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInErrorDocument" + "$ref": "#/components/schemas/errorTopLevelLinks" } ] }, @@ -3664,143 +3664,10 @@ }, "additionalProperties": false }, - "linksInErrorDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInRelationship": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceCollectionDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceData": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceDocument": { - "required": [ - "self" - ], + "errorTopLevelLinks": { "type": "object", "properties": { "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierCollectionDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, "type": "string" }, "describedby": { @@ -3819,7 +3686,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -3851,7 +3718,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -3897,15 +3764,12 @@ "additionalProperties": false }, "nullableToOneEmptyInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -3927,6 +3791,18 @@ }, "additionalProperties": false }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, "resourceAttributesInPatchRequest": { "type": "object", "properties": { @@ -4063,7 +3939,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -4089,6 +3965,30 @@ }, "additionalProperties": false }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, "resourceDataInPatchRequest": { "required": [ "id", @@ -4171,7 +4071,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -4188,6 +4088,57 @@ ], "additionalProperties": false }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, "resourcePatchRequestDocument": { "required": [ "data" @@ -4230,7 +4181,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -4413,6 +4364,18 @@ "type": "string", "additionalProperties": false }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "toManyEmptyInRequest": { "required": [ "data" @@ -4429,15 +4392,12 @@ "additionalProperties": false }, "toManyEmptyInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -4474,15 +4434,12 @@ "additionalProperties": false }, "toOneEmptyInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json index 5e7dc9e510..5dbc8dc824 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json @@ -3380,7 +3380,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -3417,7 +3417,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -3461,7 +3461,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierCollectionDocument" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, @@ -3491,7 +3491,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -3529,7 +3529,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -3626,7 +3626,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInErrorDocument" + "$ref": "#/components/schemas/errorTopLevelLinks" } ] }, @@ -3664,143 +3664,10 @@ }, "additionalProperties": false }, - "linksInErrorDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInRelationship": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceCollectionDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceData": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceDocument": { - "required": [ - "self" - ], + "errorTopLevelLinks": { "type": "object", "properties": { "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierCollectionDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, "type": "string" }, "describedby": { @@ -3819,7 +3686,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -3851,7 +3718,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -3897,15 +3764,12 @@ "additionalProperties": false }, "nullableToOneEmptyInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -3927,6 +3791,18 @@ }, "additionalProperties": false }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, "resourceAttributesInPatchRequest": { "type": "object", "properties": { @@ -4057,7 +3933,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -4083,6 +3959,30 @@ }, "additionalProperties": false }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, "resourceDataInPatchRequest": { "required": [ "id", @@ -4165,7 +4065,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -4182,6 +4082,57 @@ ], "additionalProperties": false }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, "resourcePatchRequestDocument": { "required": [ "data" @@ -4224,7 +4175,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -4407,6 +4358,18 @@ "type": "string", "additionalProperties": false }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "toManyEmptyInRequest": { "required": [ "data" @@ -4423,15 +4386,12 @@ "additionalProperties": false }, "toManyEmptyInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -4468,15 +4428,12 @@ "additionalProperties": false }, "toOneEmptyInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, diff --git a/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json index 1be450439a..fc15aeb53d 100644 --- a/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json @@ -4036,7 +4036,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -4080,7 +4080,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -4124,7 +4124,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierCollectionDocument" + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" } ] }, @@ -4154,7 +4154,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -4185,7 +4185,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -4229,7 +4229,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -4326,7 +4326,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInErrorDocument" + "$ref": "#/components/schemas/errorTopLevelLinks" } ] }, @@ -4364,143 +4364,10 @@ }, "additionalProperties": false }, - "linksInErrorDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInRelationship": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceCollectionDocument": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceData": { - "required": [ - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceDocument": { - "required": [ - "self" - ], + "errorTopLevelLinks": { "type": "object", "properties": { "self": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierCollectionDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, - "type": "string" - }, - "describedby": { - "type": "string" - }, - "first": { - "type": "string" - }, - "last": { - "type": "string" - }, - "prev": { - "type": "string" - }, - "next": { - "type": "string" - } - }, - "additionalProperties": false - }, - "linksInResourceIdentifierDocument": { - "required": [ - "related", - "self" - ], - "type": "object", - "properties": { - "self": { - "minLength": 1, - "type": "string" - }, - "related": { - "minLength": 1, "type": "string" }, "describedby": { @@ -4519,7 +4386,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceIdentifierDocument" + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" } ] }, @@ -4551,7 +4418,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -4597,15 +4464,12 @@ "additionalProperties": false }, "nullableToOneDataStreamInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -4655,7 +4519,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -4706,7 +4570,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -4733,7 +4597,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -4815,7 +4679,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceCollectionDocument" + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" } ] }, @@ -4866,7 +4730,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -4893,7 +4757,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] }, @@ -4947,6 +4811,105 @@ }, "additionalProperties": false }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, "toManyDataStreamInRequest": { "required": [ "data" @@ -4963,15 +4926,12 @@ "additionalProperties": false }, "toManyDataStreamInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -5008,15 +4968,12 @@ "additionalProperties": false }, "toOneDataStreamInResponse": { - "required": [ - "links" - ], "type": "object", "properties": { "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInRelationship" + "$ref": "#/components/schemas/relationshipLinks" } ] }, @@ -5173,7 +5130,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceData" + "$ref": "#/components/schemas/resourceLinks" } ] }, @@ -5232,7 +5189,7 @@ "links": { "allOf": [ { - "$ref": "#/components/schemas/linksInResourceDocument" + "$ref": "#/components/schemas/resourceTopLevelLinks" } ] },