From 22f6d9252cd2b12a19a4f2cb20dbfd6ae1f9a784 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Wed, 27 Nov 2024 23:57:48 +0100 Subject: [PATCH 1/9] Various small internal cleanups --- docs/usage/openapi-client.md | 4 ++-- .../OpenApiKiotaClientExample.csproj | 11 ++--------- .../Bodies/AtomicOperationsBodySchemaGenerator.cs | 12 ++++++------ .../Components/DataContainerSchemaGenerator.cs | 15 ++++++++++----- .../UnusedComponentSchemaCleaner.cs | 3 +++ src/JsonApiDotNetCore/Properties/AssemblyInfo.cs | 2 +- .../OpenApiKiotaEndToEndTests.csproj | 14 +++++++++++--- .../QueryStrings/IncludeTests.cs | 2 +- .../RestrictedControllers/CreateResourceTests.cs | 2 +- .../BaseOpenApiNSwagClientTests.cs | 4 ++-- .../QueryStrings/IncludeTests.cs | 2 +- .../RestrictedControllers/CreateResourceTests.cs | 2 +- 12 files changed, 41 insertions(+), 32 deletions(-) diff --git a/docs/usage/openapi-client.md b/docs/usage/openapi-client.md index 8f97ec090c..f8a4dd4cec 100644 --- a/docs/usage/openapi-client.md +++ b/docs/usage/openapi-client.md @@ -220,13 +220,13 @@ Our [example project](https://github.com/json-api-dotnet/JsonApiDotNetCore/tree/ which seems to work. If you're an MSBuild expert, please help out! ```xml - + - diff --git a/src/Examples/OpenApiKiotaClientExample/OpenApiKiotaClientExample.csproj b/src/Examples/OpenApiKiotaClientExample/OpenApiKiotaClientExample.csproj index d0877c32e7..78dda553e9 100644 --- a/src/Examples/OpenApiKiotaClientExample/OpenApiKiotaClientExample.csproj +++ b/src/Examples/OpenApiKiotaClientExample/OpenApiKiotaClientExample.csproj @@ -20,21 +20,14 @@ - + - - diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/AtomicOperationsBodySchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/AtomicOperationsBodySchemaGenerator.cs index d2d1220d30..6bec8e4636 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/AtomicOperationsBodySchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/AtomicOperationsBodySchemaGenerator.cs @@ -117,7 +117,7 @@ private void GenerateSchemaForOperation(ResourceType resourceType, SchemaReposit private void GenerateSchemaForResourceOperation(Type operationOpenType, ResourceType resourceType, AtomicOperationCode operationCode, SchemaRepository schemaRepository) { - WriteOperationKind operationKind = operationCode switch + WriteOperationKind writeOperation = operationCode switch { AtomicOperationCode.Add => WriteOperationKind.CreateResource, AtomicOperationCode.Update => WriteOperationKind.UpdateResource, @@ -125,7 +125,7 @@ private void GenerateSchemaForResourceOperation(Type operationOpenType, Resource _ => throw new UnreachableCodeException() }; - if (!_atomicOperationFilter.IsEnabled(resourceType, operationKind)) + if (!_atomicOperationFilter.IsEnabled(resourceType, writeOperation)) { return; } @@ -154,7 +154,7 @@ private void GenerateSchemaForResourceOperation(Type operationOpenType, Resource private void GenerateSchemaForRelationshipOperation(Type operationOpenType, RelationshipAttribute relationship, AtomicOperationCode operationCode, SchemaRepository schemaRepository) { - WriteOperationKind operationKind = operationCode switch + WriteOperationKind writeOperation = operationCode switch { AtomicOperationCode.Add => WriteOperationKind.AddToRelationship, AtomicOperationCode.Update => WriteOperationKind.SetRelationship, @@ -162,17 +162,17 @@ private void GenerateSchemaForRelationshipOperation(Type operationOpenType, Rela _ => throw new UnreachableCodeException() }; - if (!_atomicOperationFilter.IsEnabled(relationship.LeftType, operationKind)) + if (!_atomicOperationFilter.IsEnabled(relationship.LeftType, writeOperation)) { return; } - if (relationship is HasOneAttribute hasOneRelationship && !IsToOneRelationshipEnabled(hasOneRelationship, operationKind)) + if (relationship is HasOneAttribute hasOneRelationship && !IsToOneRelationshipEnabled(hasOneRelationship, writeOperation)) { return; } - if (relationship is HasManyAttribute hasManyRelationship && !IsToManyRelationshipEnabled(hasManyRelationship, operationKind)) + if (relationship is HasManyAttribute hasManyRelationship && !IsToManyRelationshipEnabled(hasManyRelationship, writeOperation)) { return; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataContainerSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataContainerSchemaGenerator.cs index d03ba0e116..800d1c2de1 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataContainerSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataContainerSchemaGenerator.cs @@ -37,6 +37,11 @@ public OpenApiSchema GenerateSchema(Type dataContainerConstructedType, ResourceT ArgumentGuard.NotNull(resourceType); ArgumentGuard.NotNull(schemaRepository); + if (schemaRepository.TryLookupByType(dataContainerConstructedType, out OpenApiSchema referenceSchemaForData)) + { + return referenceSchemaForData; + } + if (!forRequestSchema) { // There's no way to intercept in the Swashbuckle recursive component schema generation when using schema inheritance, which we need @@ -45,7 +50,7 @@ public OpenApiSchema GenerateSchema(Type dataContainerConstructedType, ResourceT _ = _abstractResourceDataSchemaGenerator.GenerateSchema(schemaRepository); } - Type dataConstructedType = GetInnerTypeOfDataProperty(dataContainerConstructedType, resourceType); + Type dataConstructedType = GetElementTypeOfDataProperty(dataContainerConstructedType, resourceType); if (!forRequestSchema) { @@ -54,7 +59,7 @@ public OpenApiSchema GenerateSchema(Type dataContainerConstructedType, ResourceT EnsureResourceDataInResponseDerivedTypesAreMappedInDiscriminator(dataConstructedType, schemaRepository); } - OpenApiSchema referenceSchemaForData = _dataSchemaGenerator.GenerateSchema(dataConstructedType, schemaRepository); + referenceSchemaForData = _dataSchemaGenerator.GenerateSchema(dataConstructedType, schemaRepository); if (!forRequestSchema) { @@ -64,7 +69,7 @@ public OpenApiSchema GenerateSchema(Type dataContainerConstructedType, ResourceT return referenceSchemaForData; } - private static Type GetInnerTypeOfDataProperty(Type dataContainerConstructedType, ResourceType resourceType) + private static Type GetElementTypeOfDataProperty(Type dataContainerConstructedType, ResourceType resourceType) { PropertyInfo? dataProperty = dataContainerConstructedType.GetProperty("Data"); @@ -98,9 +103,9 @@ private void EnsureResourceDataInResponseDerivedTypesAreMappedInDiscriminator(Ty { var resourceTypeInfo = ResourceTypeInfo.Create(dataConstructedType, _resourceGraph); - foreach (ResourceType resourceType in _includeDependencyScanner.GetReachableRelatedTypes(resourceTypeInfo.ResourceType)) + foreach (ResourceType relatedType in _includeDependencyScanner.GetReachableRelatedTypes(resourceTypeInfo.ResourceType)) { - MapResourceDataInResponseDerivedTypeInDiscriminator(resourceType, schemaRepository); + MapResourceDataInResponseDerivedTypeInDiscriminator(relatedType, schemaRepository); } } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/UnusedComponentSchemaCleaner.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/UnusedComponentSchemaCleaner.cs index 7270565e7c..c2e9ba4db1 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/UnusedComponentSchemaCleaner.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/UnusedComponentSchemaCleaner.cs @@ -14,6 +14,9 @@ internal sealed class UnusedComponentSchemaCleaner : IDocumentFilter { public void Apply(OpenApiDocument document, DocumentFilterContext context) { + ArgumentGuard.NotNull(document); + ArgumentGuard.NotNull(context); + bool hasChanges; do diff --git a/src/JsonApiDotNetCore/Properties/AssemblyInfo.cs b/src/JsonApiDotNetCore/Properties/AssemblyInfo.cs index 5756b5e845..051885a6bc 100644 --- a/src/JsonApiDotNetCore/Properties/AssemblyInfo.cs +++ b/src/JsonApiDotNetCore/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("JsonApiDotNetCore.OpenApi.Swashbuckle")] [assembly: InternalsVisibleTo("Benchmarks")] [assembly: InternalsVisibleTo("DapperExample")] +[assembly: InternalsVisibleTo("JsonApiDotNetCore.OpenApi.Swashbuckle")] [assembly: InternalsVisibleTo("JsonApiDotNetCoreTests")] [assembly: InternalsVisibleTo("UnitTests")] diff --git a/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj b/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj index 35cf974a31..5370723e4f 100644 --- a/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj +++ b/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj @@ -25,7 +25,14 @@ - + + + + + + + + + - - diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/IncludeTests.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/IncludeTests.cs index ac21646d39..71b2b930ff 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/IncludeTests.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/IncludeTests.cs @@ -186,7 +186,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Included.ShouldHaveCount(1); - NodeDataInResponse? include = response.Included.ElementAt(0).Should().BeOfType().Subject; + NodeDataInResponse include = response.Included.ElementAt(0).Should().BeOfType().Subject; include.Id.Should().Be(node.Parent.Parent.StringId); include.Attributes.ShouldNotBeNull(); include.Attributes.Name.Should().Be(node.Parent.Parent.Name); diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs index d63a96d4b0..038d49c099 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs @@ -118,7 +118,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => audioStream.Attributes.ShouldNotBeNull(); audioStream.Attributes.BytesTransmitted.Should().Be((long?)existingAudioStream.BytesTransmitted); - long newChannelId = int.Parse(response.Data.Id.ShouldNotBeNull()); + long newChannelId = long.Parse(response.Data.Id.ShouldNotBeNull()); await _testContext.RunOnDatabaseAsync(async dbContext => { diff --git a/test/OpenApiNSwagClientTests/BaseOpenApiNSwagClientTests.cs b/test/OpenApiNSwagClientTests/BaseOpenApiNSwagClientTests.cs index 828d368c7e..d8a7e5add4 100644 --- a/test/OpenApiNSwagClientTests/BaseOpenApiNSwagClientTests.cs +++ b/test/OpenApiNSwagClientTests/BaseOpenApiNSwagClientTests.cs @@ -15,9 +15,9 @@ public abstract class BaseOpenApiNSwagClientTests ParameterExpression parameter = Expression.Parameter(attributesObjectType, AttributesObjectParameterName); MemberExpression property = Expression.Property(parameter, propertyName); - UnaryExpression toObjectConversion = Expression.Convert(property, typeof(object)); + UnaryExpression castToObject = Expression.Convert(property, typeof(object)); - return Expression.Lambda>(toObjectConversion, parameter); + return Expression.Lambda>(castToObject, parameter); } /// diff --git a/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs b/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs index 98a7ee12ea..3952a347d1 100644 --- a/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs +++ b/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs @@ -168,7 +168,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Included.ShouldHaveCount(1); - NodeDataInResponse? include = response.Included.ElementAt(0).Should().BeOfType().Subject; + NodeDataInResponse include = response.Included.ElementAt(0).Should().BeOfType().Subject; include.Id.Should().Be(node.Parent.Parent.StringId); include.Attributes.ShouldNotBeNull(); include.Attributes.Name.Should().Be(node.Parent.Parent.Name); diff --git a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs index 8478cf5def..61e1e9df1e 100644 --- a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs +++ b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs @@ -112,7 +112,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => audioStream.Attributes.ShouldNotBeNull(); audioStream.Attributes.BytesTransmitted.Should().Be((long?)existingAudioStream.BytesTransmitted); - long newChannelId = int.Parse(response.Data.Id.ShouldNotBeNull()); + long newChannelId = long.Parse(response.Data.Id.ShouldNotBeNull()); await _testContext.RunOnDatabaseAsync(async dbContext => { From b38f1952b78d0a7617b9ca01e5e995a68941e351 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Thu, 28 Nov 2024 00:25:39 +0100 Subject: [PATCH 2/9] Fixed: do not emit AdditionalProperties on relationshipName and resourceType enums --- .../JsonApiDotNetCoreExample.json | 27 +++++--------- .../RelationshipNameSchemaGenerator.cs | 3 +- .../Components/ResourceTypeSchemaGenerator.cs | 3 +- .../GeneratedSwagger/swagger.g.json | 36 +++++++------------ .../AtomicOperations/OperationsTests.cs | 15 +++----- .../GeneratedSwagger/swagger.g.json | 9 ++--- .../Headers/GeneratedSwagger/swagger.g.json | 6 ++-- .../GeneratedSwagger/swagger.g.json | 12 +++---- .../LegacyOpenApi/expected-swagger.json | 12 +++---- .../Enabled/GeneratedSwagger/swagger.g.json | 12 +++---- .../GeneratedSwagger/net6.0/swagger.g.json | 3 +- .../GeneratedSwagger/net8.0/swagger.g.json | 3 +- .../CamelCase/GeneratedSwagger/swagger.g.json | 15 +++----- .../KebabCase/GeneratedSwagger/swagger.g.json | 15 +++----- .../GeneratedSwagger/swagger.g.json | 15 +++----- .../GeneratedSwagger/swagger.g.json | 6 ++-- .../GeneratedSwagger/swagger.g.json | 6 ++-- .../GeneratedSwagger/swagger.g.json | 6 ++-- .../GeneratedSwagger/swagger.g.json | 6 ++-- .../GeneratedSwagger/swagger.g.json | 6 ++-- .../GeneratedSwagger/swagger.g.json | 6 ++-- 21 files changed, 74 insertions(+), 148 deletions(-) diff --git a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json index 3980e2c526..9216c310e8 100644 --- a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json +++ b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json @@ -6071,8 +6071,7 @@ "enum": [ "assignedTodoItems" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "personAttributesInResponse": { "type": "object", @@ -6292,8 +6291,7 @@ "enum": [ "ownedTodoItems" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "personPrimaryResponseDocument": { "required": [ @@ -6356,8 +6354,7 @@ "enum": [ "people" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "personSecondaryResponseDocument": { "required": [ @@ -7007,8 +7004,7 @@ "enum": [ "tags" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "tagTodoItemsRelationshipIdentifier": { "required": [ @@ -7047,8 +7043,7 @@ "enum": [ "todoItems" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "toManyTagInRequest": { "required": [ @@ -7212,8 +7207,7 @@ "enum": [ "assignee" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "todoItemAttributesInResponse": { "type": "object", @@ -7445,8 +7439,7 @@ "enum": [ "owner" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "todoItemPrimaryResponseDocument": { "required": [ @@ -7524,8 +7517,7 @@ "enum": [ "todoItems" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "todoItemTagsRelationshipIdentifier": { "required": [ @@ -7564,8 +7556,7 @@ "enum": [ "tags" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "updateOperationCode": { "enum": [ diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipNameSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipNameSchemaGenerator.cs index 5a4ee81fe6..5844e8184b 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipNameSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipNameSchemaGenerator.cs @@ -38,8 +38,7 @@ public OpenApiSchema GenerateSchema(RelationshipAttribute relationship, SchemaRe var fullSchema = new OpenApiSchema { Type = "string", - Enum = [new OpenApiString(relationship.PublicName)], - AdditionalPropertiesAllowed = false + Enum = [new OpenApiString(relationship.PublicName)] }; return schemaRepository.AddDefinition(schemaId, fullSchema); diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceTypeSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceTypeSchemaGenerator.cs index 7fd9fc4d96..4f63261a44 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceTypeSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceTypeSchemaGenerator.cs @@ -29,8 +29,7 @@ public OpenApiSchema GenerateSchema(ResourceType resourceType, SchemaRepository var fullSchema = new OpenApiSchema { Type = "string", - Enum = [new OpenApiString(resourceType.PublicName)], - AdditionalPropertiesAllowed = false + Enum = [new OpenApiString(resourceType.PublicName)] }; string schemaId = _schemaIdSelector.GetResourceTypeSchemaId(resourceType); diff --git a/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json index c223858dae..e2012c53b7 100644 --- a/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json @@ -6838,8 +6838,7 @@ "enum": [ "enrollments" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "courseIdentifierCollectionResponseDocument": { "required": [ @@ -7031,8 +7030,7 @@ "enum": [ "courses" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "courseSecondaryResponseDocument": { "required": [ @@ -7115,8 +7113,7 @@ "enum": [ "taughtBy" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "createCourseOperation": { "allOf": [ @@ -7822,8 +7819,7 @@ "enum": [ "course" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "enrollmentDataInResponse": { "allOf": [ @@ -8027,8 +8023,7 @@ "enum": [ "enrollments" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "enrollmentStudentRelationshipIdentifier": { "required": [ @@ -8067,8 +8062,7 @@ "enum": [ "student" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "errorLinks": { "type": "object", @@ -8952,8 +8946,7 @@ "enum": [ "enrollments" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "studentIdentifierCollectionResponseDocument": { "required": [ @@ -9114,8 +9107,7 @@ "enum": [ "mentor" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "studentPrimaryResponseDocument": { "required": [ @@ -9185,8 +9177,7 @@ "enum": [ "students" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "studentSecondaryResponseDocument": { "required": [ @@ -9459,8 +9450,7 @@ "enum": [ "mentors" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "teacherPrimaryResponseDocument": { "required": [ @@ -9530,8 +9520,7 @@ "enum": [ "teachers" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "teacherTeachesRelationshipIdentifier": { "required": [ @@ -9570,8 +9559,7 @@ "enum": [ "teaches" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "toManyCourseInRequest": { "required": [ diff --git a/test/OpenApiTests/AtomicOperations/OperationsTests.cs b/test/OpenApiTests/AtomicOperations/OperationsTests.cs index b7bf6521c1..bad26839e1 100644 --- a/test/OpenApiTests/AtomicOperations/OperationsTests.cs +++ b/test/OpenApiTests/AtomicOperations/OperationsTests.cs @@ -751,8 +751,7 @@ public async Task Course_operation_component_schemas_are_exposed() "enum": [ "enrollments" ], - "type": "string", - "additionalProperties": false + "type": "string" } """); }); @@ -1246,8 +1245,7 @@ public async Task Student_operation_component_schemas_are_exposed() "enum": [ "mentor" ], - "type": "string", - "additionalProperties": false + "type": "string" } """); @@ -1292,8 +1290,7 @@ public async Task Student_operation_component_schemas_are_exposed() "enum": [ "enrollments" ], - "type": "string", - "additionalProperties": false + "type": "string" } """); }); @@ -1776,8 +1773,7 @@ public async Task Teacher_operation_component_schemas_are_exposed() "enum": [ "mentors" ], - "type": "string", - "additionalProperties": false + "type": "string" } """); }); @@ -2182,8 +2178,7 @@ public async Task Enrollment_operation_component_schemas_are_exposed() "enum": [ "course" ], - "type": "string", - "additionalProperties": false + "type": "string" } """); }); diff --git a/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json index a951355eec..b70da46c83 100644 --- a/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json @@ -802,8 +802,7 @@ "enum": [ "games" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "meta": { "type": "object", @@ -1027,8 +1026,7 @@ "enum": [ "playerGroups" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "playerIdentifierInRequest": { "required": [ @@ -1135,8 +1133,7 @@ "enum": [ "players" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "relationshipLinks": { "type": "object", diff --git a/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json index 9d539491b0..679f1be432 100644 --- a/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json @@ -1332,8 +1332,7 @@ "enum": [ "countries" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "createCountryRequestDocument": { "required": [ @@ -1729,8 +1728,7 @@ "enum": [ "languages" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "meta": { "type": "object", diff --git a/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json index 7b44840145..4484ec1665 100644 --- a/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json @@ -6072,8 +6072,7 @@ "enum": [ "airplanes" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "attributes-in-create-airplane-request": { "required": [ @@ -6981,8 +6980,7 @@ "enum": [ "flight-attendants" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "flight-attendant-secondary-response-document": { "required": [ @@ -7316,8 +7314,7 @@ "enum": [ "flights" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "jsonapi": { "type": "object", @@ -7708,8 +7705,7 @@ "enum": [ "passengers" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "relationship-links": { "type": "object", diff --git a/test/OpenApiTests/LegacyOpenApi/expected-swagger.json b/test/OpenApiTests/LegacyOpenApi/expected-swagger.json index 7b44840145..4484ec1665 100644 --- a/test/OpenApiTests/LegacyOpenApi/expected-swagger.json +++ b/test/OpenApiTests/LegacyOpenApi/expected-swagger.json @@ -6072,8 +6072,7 @@ "enum": [ "airplanes" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "attributes-in-create-airplane-request": { "required": [ @@ -6981,8 +6980,7 @@ "enum": [ "flight-attendants" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "flight-attendant-secondary-response-document": { "required": [ @@ -7316,8 +7314,7 @@ "enum": [ "flights" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "jsonapi": { "type": "object", @@ -7708,8 +7705,7 @@ "enum": [ "passengers" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "relationship-links": { "type": "object", diff --git a/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json index 8464efb60d..49a069b0b2 100644 --- a/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json @@ -3919,8 +3919,7 @@ "enum": [ "accommodations" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "accommodationSecondaryResponseDocument": { "required": [ @@ -4718,8 +4717,7 @@ "enum": [ "excursions" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "meta": { "type": "object", @@ -5263,8 +5261,7 @@ "enum": [ "transports" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "transportType": { "enum": [ @@ -5508,8 +5505,7 @@ "enum": [ "vacations" ], - "type": "string", - "additionalProperties": false + "type": "string" } } } diff --git a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json index 4c45328245..23ca988139 100644 --- a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json +++ b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json @@ -844,8 +844,7 @@ "enum": [ "socialMediaAccounts" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "updateSocialMediaAccountRequestDocument": { "required": [ diff --git a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json index ada76c602e..5d808573a6 100644 --- a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json +++ b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json @@ -871,8 +871,7 @@ "enum": [ "socialMediaAccounts" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "updateSocialMediaAccountRequestDocument": { "required": [ diff --git a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json index edae105235..0e06f73cd1 100644 --- a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json @@ -3960,8 +3960,7 @@ "enum": [ "staffMembers" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "staffMemberSecondaryResponseDocument": { "required": [ @@ -4060,8 +4059,7 @@ "enum": [ "backupStoreManager" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "supermarketCashiersRelationshipIdentifier": { "required": [ @@ -4100,8 +4098,7 @@ "enum": [ "cashiers" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "supermarketCollectionResponseDocument": { "required": [ @@ -4296,8 +4293,7 @@ "enum": [ "supermarkets" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "supermarketStoreManagerRelationshipIdentifier": { "required": [ @@ -4336,8 +4332,7 @@ "enum": [ "storeManager" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "supermarketType": { "enum": [ diff --git a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json index f645465952..e79d8720d9 100644 --- a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json @@ -3960,8 +3960,7 @@ "enum": [ "staff-members" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "staff-member-secondary-response-document": { "required": [ @@ -4060,8 +4059,7 @@ "enum": [ "backup-store-manager" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "supermarket-cashiers-relationship-identifier": { "required": [ @@ -4100,8 +4098,7 @@ "enum": [ "cashiers" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "supermarket-collection-response-document": { "required": [ @@ -4296,8 +4293,7 @@ "enum": [ "supermarkets" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "supermarket-store-manager-relationship-identifier": { "required": [ @@ -4336,8 +4332,7 @@ "enum": [ "store-manager" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "supermarket-type": { "enum": [ diff --git a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json index 910cf3d7df..078e4a002e 100644 --- a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json @@ -3960,8 +3960,7 @@ "enum": [ "StaffMembers" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "StaffMemberSecondaryResponseDocument": { "required": [ @@ -4060,8 +4059,7 @@ "enum": [ "BackupStoreManager" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "SupermarketCashiersRelationshipIdentifier": { "required": [ @@ -4100,8 +4098,7 @@ "enum": [ "Cashiers" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "SupermarketCollectionResponseDocument": { "required": [ @@ -4296,8 +4293,7 @@ "enum": [ "Supermarkets" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "SupermarketStoreManagerRelationshipIdentifier": { "required": [ @@ -4336,8 +4332,7 @@ "enum": [ "StoreManager" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "SupermarketType": { "enum": [ diff --git a/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json index 0abc6b4ce6..c3825a94f3 100644 --- a/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json @@ -3737,8 +3737,7 @@ "enum": [ "nameValuePairs" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "nodeAttributesInResponse": { "type": "object", @@ -4012,8 +4011,7 @@ "enum": [ "nodes" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "nodeSecondaryResponseDocument": { "required": [ diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json index 64456fceef..ec497e92b4 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json @@ -2892,8 +2892,7 @@ "enum": [ "empties" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "errorLinks": { "type": "object", @@ -3491,8 +3490,7 @@ "enum": [ "resources" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "resourceTopLevelLinks": { "type": "object", diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json index f39ddb14f0..398e6b0d55 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json @@ -2918,8 +2918,7 @@ "enum": [ "empties" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "emptySecondaryResponseDocument": { "required": [ @@ -3551,8 +3550,7 @@ "enum": [ "resources" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "resourceTopLevelLinks": { "type": "object", diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json index 4b0e50301a..9812ca4d8e 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json @@ -3790,8 +3790,7 @@ "enum": [ "empties" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "emptySecondaryResponseDocument": { "required": [ @@ -4476,8 +4475,7 @@ "enum": [ "resources" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "resourceTopLevelLinks": { "type": "object", diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json index d6cdf83455..47a4022141 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json @@ -3786,8 +3786,7 @@ "enum": [ "empties" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "emptySecondaryResponseDocument": { "required": [ @@ -4470,8 +4469,7 @@ "enum": [ "resources" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "resourceTopLevelLinks": { "type": "object", diff --git a/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json index d3ab394208..091ad52c79 100644 --- a/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json @@ -4448,8 +4448,7 @@ "enum": [ "dataStreams" ], - "type": "string", - "additionalProperties": false + "type": "string" }, "dataStreamSecondaryResponseDocument": { "required": [ @@ -5459,8 +5458,7 @@ "enum": [ "writeOnlyChannels" ], - "type": "string", - "additionalProperties": false + "type": "string" } } } From a0aec705ef913426bcf32a8d4464c6c696078f30 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Thu, 28 Nov 2024 01:13:58 +0100 Subject: [PATCH 3/9] Rename operationDiscriminator to openapi:discriminator and emit as property --- .../JsonApiDotNetCoreExample.json | 7 +++-- .../GeneratedCode/Models/AtomicOperation.cs | 20 ++++++++++++- .../ConfigureSwaggerGenOptions.cs | 2 +- .../JsonApiSchemaIdSelector.cs | 6 ---- .../AbstractAtomicOperationSchemaGenerator.cs | 30 +++++++++++-------- .../AbstractResourceDataSchemaGenerator.cs | 24 +++++++-------- .../GeneratedCode/Models/AtomicOperation.cs | 20 ++++++++++++- .../GeneratedSwagger/swagger.g.json | 7 +++-- .../AtomicOperations/OperationsTests.cs | 7 +++-- .../CamelCase/GeneratedSwagger/swagger.g.json | 7 +++-- .../KebabCase/GeneratedSwagger/swagger.g.json | 7 +++-- .../GeneratedSwagger/swagger.g.json | 7 +++-- 12 files changed, 97 insertions(+), 47 deletions(-) diff --git a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json index 9216c310e8..381b46d9dc 100644 --- a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json +++ b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json @@ -5095,10 +5095,13 @@ }, "atomicOperation": { "required": [ - "operationDiscriminator" + "openapi:discriminator" ], "type": "object", "properties": { + "openapi:discriminator": { + "type": "string" + }, "meta": { "allOf": [ { @@ -5109,7 +5112,7 @@ }, "additionalProperties": false, "discriminator": { - "propertyName": "operationDiscriminator", + "propertyName": "openapi:discriminator", "mapping": { "addPerson": "#/components/schemas/createPersonOperation", "addTag": "#/components/schemas/createTagOperation", diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AtomicOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AtomicOperation.cs index 981fb989a4..3c1d31a6f9 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AtomicOperation.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AtomicOperation.cs @@ -30,6 +30,22 @@ public partial class AtomicOperation : IBackedModel, IParsable get { return BackingStore?.Get("meta"); } set { BackingStore?.Set("meta", value); } } +#endif + /// The openapiDiscriminator property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } +#nullable restore +#else + public string OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -46,7 +62,7 @@ public AtomicOperation() public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - var mappingValue = parseNode.GetChildNode("operationDiscriminator")?.GetStringValue(); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); return mappingValue switch { "addPerson" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.CreatePersonOperation(), @@ -84,6 +100,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetStringValue(); } }, }; } /// @@ -94,6 +111,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("meta", Meta); + writer.WriteStringValue("openapi:discriminator", OpenapiDiscriminator); } } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs index 3648d07432..dd8fd06126 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs @@ -49,7 +49,7 @@ public void Configure(SwaggerGenOptions options) options.UseAllOfToExtendReferenceSchemas(); options.UseAllOfForInheritance(); - options.SelectDiscriminatorNameUsing(_ => "type"); + options.SelectDiscriminatorNameUsing(_ => JsonApiPropertyName.Type); options.SelectDiscriminatorValueUsing(clrType => _resourceGraph.GetResourceType(clrType).PublicName); options.SelectSubTypesUsing(SelectDerivedTypes); diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs index ade09cf788..9f932b9853 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs @@ -15,7 +15,6 @@ internal sealed class JsonApiSchemaIdSelector private const string ResourceTypeSchemaIdTemplate = "[ResourceName] Resource Type"; private const string MetaSchemaIdTemplate = "Meta"; - private const string AtomicOperationDiscriminatorNameTemplate = "Operation Discriminator"; private const string ResourceAtomicOperationDiscriminatorValueTemplate = "[OperationCode] [ResourceName]"; private const string UpdateRelationshipAtomicOperationDiscriminatorValueTemplate = "Update [ResourceName] [RelationshipName]"; private const string AddToRelationshipAtomicOperationDiscriminatorValueTemplate = "Add To [ResourceName] [RelationshipName]"; @@ -154,11 +153,6 @@ public string GetAtomicOperationCodeSchemaId(AtomicOperationCode operationCode) return ApplySchemaTemplate("[OperationCode] Operation Code", null, null, operationCode); } - public string GetAtomicOperationDiscriminatorName() - { - return ApplySchemaTemplate(AtomicOperationDiscriminatorNameTemplate, null, null, null); - } - public string GetAtomicOperationDiscriminatorValue(AtomicOperationCode operationCode, ResourceType resourceType) { ArgumentGuard.NotNull(resourceType); diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractAtomicOperationSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractAtomicOperationSchemaGenerator.cs index 75210ec5c8..2fde578bfc 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractAtomicOperationSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractAtomicOperationSchemaGenerator.cs @@ -1,6 +1,5 @@ using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; using Microsoft.OpenApi.Any; -using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; @@ -8,6 +7,9 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; internal sealed class AbstractAtomicOperationSchemaGenerator { + // The discriminator only exists to guide OpenAPI codegen of request bodies. It is silently ignored by the JSON:API server. + private const string DiscriminatorPropertyName = "openapi:discriminator"; + private static readonly Type AtomicOperationAbstractType = typeof(AtomicOperation); private readonly MetaSchemaGenerator _metaSchemaGenerator; @@ -31,27 +33,27 @@ public OpenApiSchema GenerateSchema(SchemaRepository schemaRepository) return referenceSchema; } - // The discriminator only exists to guide OpenAPI codegen. The property is ignored by JsonApiDotNetCore. - string discriminatorPropertyName = _schemaIdSelector.GetAtomicOperationDiscriminatorName(); - - referenceSchema = _metaSchemaGenerator.GenerateSchema(schemaRepository); - string metaSchemaId = referenceSchema.Reference.Id; + OpenApiSchema referenceSchemaForMeta = _metaSchemaGenerator.GenerateSchema(schemaRepository); var fullSchema = new OpenApiSchema { Type = "object", - Required = new SortedSet([discriminatorPropertyName]), + Required = new SortedSet([DiscriminatorPropertyName]), Properties = new Dictionary { - [metaSchemaId] = referenceSchema.WrapInExtendedSchema() + [DiscriminatorPropertyName] = new() + { + Type = "string" + }, + [referenceSchemaForMeta.Reference.Id] = referenceSchemaForMeta.WrapInExtendedSchema() }, AdditionalPropertiesAllowed = false, Discriminator = new OpenApiDiscriminator { - PropertyName = discriminatorPropertyName, + PropertyName = DiscriminatorPropertyName, Mapping = new SortedDictionary(StringComparer.Ordinal) }, - Extensions = new Dictionary + Extensions = { ["x-abstract"] = new OpenApiBoolean(true) } @@ -70,10 +72,12 @@ public void MapDiscriminator(OpenApiSchema referenceSchemaForOperation, string d ArgumentGuard.NotNull(referenceSchemaForOperation); ArgumentGuard.NotNull(schemaRepository); - if (schemaRepository.TryLookupByType(AtomicOperationAbstractType, out OpenApiSchema? referenceSchemaForAbstractOperation)) + if (!schemaRepository.TryLookupByType(AtomicOperationAbstractType, out OpenApiSchema? referenceSchemaForAbstractOperation)) { - OpenApiSchema fullSchemaForAbstractOperation = schemaRepository.Schemas[referenceSchemaForAbstractOperation.Reference.Id]; - fullSchemaForAbstractOperation.Discriminator.Mapping[discriminatorValue] = referenceSchemaForOperation.Reference.ReferenceV3; + throw new UnreachableCodeException(); } + + OpenApiSchema fullSchemaForAbstractOperation = schemaRepository.Schemas[referenceSchemaForAbstractOperation.Reference.Id]; + fullSchemaForAbstractOperation.Discriminator.Mapping.Add(discriminatorValue, referenceSchemaForOperation.Reference.ReferenceV3); } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs index 767dd73067..c7f0c8d4ae 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs @@ -2,7 +2,6 @@ using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; using Microsoft.OpenApi.Any; -using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; @@ -35,14 +34,11 @@ public OpenApiSchema GenerateSchema(SchemaRepository schemaRepository) var fullSchema = new OpenApiSchema { - Required = new HashSet - { - "type" - }, + Required = new SortedSet([JsonApiPropertyName.Type]), Type = "object", Properties = new Dictionary { - ["type"] = new() + [JsonApiPropertyName.Type] = new() { MinLength = 1, Type = "string" @@ -51,10 +47,10 @@ public OpenApiSchema GenerateSchema(SchemaRepository schemaRepository) AdditionalPropertiesAllowed = false, Discriminator = new OpenApiDiscriminator { - PropertyName = "type", + PropertyName = JsonApiPropertyName.Type, Mapping = new SortedDictionary(StringComparer.Ordinal) }, - Extensions = new Dictionary + Extensions = { ["x-abstract"] = new OpenApiBoolean(true) } @@ -78,13 +74,15 @@ public void MapDiscriminator(Type resourceDataConstructedType, OpenApiSchema ref if (resourceTypeInfo.ResourceDataOpenType == typeof(ResourceDataInResponse<>)) { - if (schemaRepository.TryLookupByType(ResourceDataAbstractType, out OpenApiSchema? referenceSchemaForAbstractResourceData)) + if (!schemaRepository.TryLookupByType(ResourceDataAbstractType, out OpenApiSchema? referenceSchemaForAbstractResourceData)) { - OpenApiSchema fullSchemaForAbstractResourceData = schemaRepository.Schemas[referenceSchemaForAbstractResourceData.Reference.Id]; - - fullSchemaForAbstractResourceData.Discriminator.Mapping[resourceTypeInfo.ResourceType.PublicName] = - referenceSchemaForResourceData.Reference.ReferenceV3; + throw new UnreachableCodeException(); } + + OpenApiSchema fullSchemaForAbstractResourceData = schemaRepository.Schemas[referenceSchemaForAbstractResourceData.Reference.Id]; + + fullSchemaForAbstractResourceData.Discriminator.Mapping[resourceTypeInfo.ResourceType.PublicName] = + referenceSchemaForResourceData.Reference.ReferenceV3; } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AtomicOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AtomicOperation.cs index 7d92919427..32c434fb14 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AtomicOperation.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AtomicOperation.cs @@ -30,6 +30,22 @@ public partial class AtomicOperation : IBackedModel, IParsable get { return BackingStore?.Get("meta"); } set { BackingStore?.Set("meta", value); } } +#endif + /// The openapiDiscriminator property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public string? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } +#nullable restore +#else + public string OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -46,7 +62,7 @@ public AtomicOperation() public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation CreateFromDiscriminatorValue(IParseNode parseNode) { _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); - var mappingValue = parseNode.GetChildNode("operationDiscriminator")?.GetStringValue(); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); return mappingValue switch { "addCourse" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CreateCourseOperation(), @@ -87,6 +103,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetStringValue(); } }, }; } /// @@ -97,6 +114,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("meta", Meta); + writer.WriteStringValue("openapi:discriminator", OpenapiDiscriminator); } } } diff --git a/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json index e2012c53b7..42596a0e47 100644 --- a/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json @@ -6512,10 +6512,13 @@ }, "atomicOperation": { "required": [ - "operationDiscriminator" + "openapi:discriminator" ], "type": "object", "properties": { + "openapi:discriminator": { + "type": "string" + }, "meta": { "allOf": [ { @@ -6526,7 +6529,7 @@ }, "additionalProperties": false, "discriminator": { - "propertyName": "operationDiscriminator", + "propertyName": "openapi:discriminator", "mapping": { "addCourse": "#/components/schemas/createCourseOperation", "addEnrollment": "#/components/schemas/createEnrollmentOperation", diff --git a/test/OpenApiTests/AtomicOperations/OperationsTests.cs b/test/OpenApiTests/AtomicOperations/OperationsTests.cs index bad26839e1..ad10cc6f2d 100644 --- a/test/OpenApiTests/AtomicOperations/OperationsTests.cs +++ b/test/OpenApiTests/AtomicOperations/OperationsTests.cs @@ -160,10 +160,13 @@ public async Task Operations_request_component_schemas_are_exposed() schemasElement.Should().ContainPath("atomicOperation").Should().BeJson(""" { "required": [ - "operationDiscriminator" + "openapi:discriminator" ], "type": "object", "properties": { + "openapi:discriminator": { + "type": "string" + }, "meta": { "allOf": [ { @@ -174,7 +177,7 @@ public async Task Operations_request_component_schemas_are_exposed() }, "additionalProperties": false, "discriminator": { - "propertyName": "operationDiscriminator", + "propertyName": "openapi:discriminator", "mapping": { "addCourse": "#/components/schemas/createCourseOperation", "addEnrollment": "#/components/schemas/createEnrollmentOperation", diff --git a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json index 0e06f73cd1..9c2975d6f8 100644 --- a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json @@ -2709,10 +2709,13 @@ }, "atomicOperation": { "required": [ - "operationDiscriminator" + "openapi:discriminator" ], "type": "object", "properties": { + "openapi:discriminator": { + "type": "string" + }, "meta": { "allOf": [ { @@ -2723,7 +2726,7 @@ }, "additionalProperties": false, "discriminator": { - "propertyName": "operationDiscriminator", + "propertyName": "openapi:discriminator", "mapping": { "addStaffMember": "#/components/schemas/createStaffMemberOperation", "addSupermarket": "#/components/schemas/createSupermarketOperation", diff --git a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json index e79d8720d9..42e364b323 100644 --- a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json @@ -2709,10 +2709,13 @@ }, "atomic-operation": { "required": [ - "operation-discriminator" + "openapi:discriminator" ], "type": "object", "properties": { + "openapi:discriminator": { + "type": "string" + }, "meta": { "allOf": [ { @@ -2723,7 +2726,7 @@ }, "additionalProperties": false, "discriminator": { - "propertyName": "operation-discriminator", + "propertyName": "openapi:discriminator", "mapping": { "add-staff-member": "#/components/schemas/create-staff-member-operation", "add-supermarket": "#/components/schemas/create-supermarket-operation", diff --git a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json index 078e4a002e..532eded4b7 100644 --- a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json @@ -2709,10 +2709,13 @@ }, "AtomicOperation": { "required": [ - "OperationDiscriminator" + "openapi:discriminator" ], "type": "object", "properties": { + "openapi:discriminator": { + "type": "string" + }, "Meta": { "allOf": [ { @@ -2723,7 +2726,7 @@ }, "additionalProperties": false, "discriminator": { - "propertyName": "OperationDiscriminator", + "propertyName": "openapi:discriminator", "mapping": { "AddStaffMember": "#/components/schemas/CreateStaffMemberOperation", "AddSupermarket": "#/components/schemas/CreateSupermarketOperation", From e1937591d9c5640e590b2fda7ef49e01884f1e8b Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Thu, 28 Nov 2024 02:54:59 +0100 Subject: [PATCH 4/9] Add missing meta in resource identifier objects, add missing meta in request resource objects, move meta in response resource objects to abstract base schema --- .../JsonApiDotNetCoreExample.json | 112 +++++++++--- .../Models/DataInCreatePersonRequest.cs | 18 ++ .../Models/DataInCreateTagRequest.cs | 18 ++ .../Models/DataInCreateTodoItemRequest.cs | 18 ++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++ .../Models/DataInUpdatePersonRequest.cs | 18 ++ .../Models/DataInUpdateTagRequest.cs | 18 ++ .../Models/DataInUpdateTodoItemRequest.cs | 18 ++ .../Models/PersonDataInResponse.cs | 18 -- .../Models/PersonIdentifierInRequest.cs | 18 ++ .../Models/PersonIdentifierInResponse.cs | 18 ++ .../GeneratedCode/Models/TagDataInResponse.cs | 18 -- .../Models/TagIdentifierInRequest.cs | 18 ++ .../Models/TagIdentifierInResponse.cs | 18 ++ .../Models/TodoItemDataInResponse.cs | 18 -- .../Models/TodoItemIdentifierInRequest.cs | 18 ++ .../Models/TodoItemIdentifierInResponse.cs | 18 ++ .../ResourceObjects/IResourceIdentity.cs | 1 + .../ResourceObjects/ResourceData.cs | 3 + .../ResourceObjects/ResourceDataInResponse.cs | 3 - .../ResourceIdentifierInRequest.cs | 3 + .../ResourceIdentifierInResponse.cs | 5 + .../AbstractResourceDataSchemaGenerator.cs | 10 +- .../Components/DataSchemaGenerator.cs | 159 ++++++++++-------- .../RelationshipIdentifierSchemaGenerator.cs | 2 + .../Models/CourseDataInResponse.cs | 18 -- .../Models/CourseIdentifierInRequest.cs | 18 ++ .../Models/CourseIdentifierInResponse.cs | 18 ++ .../Models/DataInCreateCourseRequest.cs | 18 ++ .../Models/DataInCreateEnrollmentRequest.cs | 18 ++ .../Models/DataInCreateStudentRequest.cs | 18 ++ .../Models/DataInCreateTeacherRequest.cs | 18 ++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++ .../Models/DataInUpdateCourseRequest.cs | 18 ++ .../Models/DataInUpdateEnrollmentRequest.cs | 18 ++ .../Models/DataInUpdateStudentRequest.cs | 18 ++ .../Models/DataInUpdateTeacherRequest.cs | 18 ++ .../Models/EnrollmentDataInResponse.cs | 18 -- .../Models/EnrollmentIdentifierInRequest.cs | 18 ++ .../Models/EnrollmentIdentifierInResponse.cs | 18 ++ .../Models/StudentDataInResponse.cs | 18 -- .../Models/StudentIdentifierInRequest.cs | 18 ++ .../Models/StudentIdentifierInResponse.cs | 18 ++ .../Models/TeacherDataInResponse.cs | 18 -- .../Models/TeacherIdentifierInRequest.cs | 18 ++ .../Models/TeacherIdentifierInResponse.cs | 18 ++ .../Models/DataInCreateGameRequest.cs | 18 ++ .../Models/DataInCreatePlayerGroupRequest.cs | 18 ++ .../Models/DataInCreatePlayerRequest.cs | 18 ++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++ .../Models/GameDataInResponse.cs | 18 -- .../Models/GameIdentifierInRequest.cs | 18 ++ .../Models/GameIdentifierInResponse.cs | 18 ++ .../Models/PlayerDataInResponse.cs | 18 -- .../Models/PlayerGroupDataInResponse.cs | 18 -- .../Models/PlayerGroupIdentifierInRequest.cs | 18 ++ .../Models/PlayerGroupIdentifierInResponse.cs | 18 ++ .../Models/PlayerIdentifierInRequest.cs | 18 ++ .../Models/PlayerIdentifierInResponse.cs | 18 ++ .../Models/CountryDataInResponse.cs | 18 -- .../Models/DataInCreateCountryRequest.cs | 18 ++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++ .../Models/DataInUpdateCountryRequest.cs | 18 ++ .../Models/LanguageDataInResponse.cs | 18 -- .../Models/LanguageIdentifierInRequest.cs | 18 ++ .../Models/LanguageIdentifierInResponse.cs | 18 ++ .../Models/AccommodationDataInResponse.cs | 18 -- .../AccommodationIdentifierInRequest.cs | 18 ++ .../AccommodationIdentifierInResponse.cs | 18 ++ .../DataInCreateAccommodationRequest.cs | 18 ++ .../Models/DataInCreateExcursionRequest.cs | 18 ++ .../Models/DataInCreateTransportRequest.cs | 18 ++ .../Models/DataInCreateVacationRequest.cs | 18 ++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++ .../DataInUpdateAccommodationRequest.cs | 18 ++ .../Models/DataInUpdateExcursionRequest.cs | 18 ++ .../Models/DataInUpdateTransportRequest.cs | 18 ++ .../Models/DataInUpdateVacationRequest.cs | 18 ++ .../Models/ExcursionDataInResponse.cs | 18 -- .../Models/ExcursionIdentifierInRequest.cs | 18 ++ .../Models/ExcursionIdentifierInResponse.cs | 18 ++ .../Models/TransportDataInResponse.cs | 18 -- .../Models/TransportIdentifierInRequest.cs | 18 ++ .../Models/TransportIdentifierInResponse.cs | 18 ++ .../Models/VacationDataInResponse.cs | 18 -- .../DataInCreateSocialMediaAccountRequest.cs | 18 ++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++ .../DataInUpdateSocialMediaAccountRequest.cs | 18 ++ .../SocialMediaAccountDataInResponse.cs | 18 -- .../DataInCreateNameValuePairRequest.cs | 18 ++ .../Models/DataInCreateNodeRequest.cs | 18 ++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++ .../DataInUpdateNameValuePairRequest.cs | 18 ++ .../Models/DataInUpdateNodeRequest.cs | 18 ++ .../Models/NameValuePairDataInResponse.cs | 18 -- .../NameValuePairIdentifierInRequest.cs | 18 ++ .../NameValuePairIdentifierInResponse.cs | 18 ++ .../Models/NodeDataInResponse.cs | 18 -- .../Models/NodeIdentifierInRequest.cs | 18 ++ .../Models/NodeIdentifierInResponse.cs | 18 ++ .../DataInCreateWriteOnlyChannelRequest.cs | 18 ++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++ .../DataInUpdateWriteOnlyChannelRequest.cs | 18 ++ .../Models/DataStreamDataInResponse.cs | 18 -- .../Models/DataStreamIdentifierInRequest.cs | 18 ++ .../Models/DataStreamIdentifierInResponse.cs | 18 ++ .../Models/ReadOnlyChannelDataInResponse.cs | 18 -- .../ReadOnlyResourceChannelDataInResponse.cs | 18 -- .../Models/WriteOnlyChannelDataInResponse.cs | 18 -- .../GeneratedSwagger/swagger.g.json | 147 +++++++++++++--- .../AtomicOperations/OperationsTests.cs | 84 +++++++++ .../GeneratedSwagger/swagger.g.json | 91 +++++++--- .../Headers/GeneratedSwagger/swagger.g.json | 49 ++++-- .../GeneratedSwagger/swagger.g.json | 133 ++++++++++++--- .../LegacyOpenApi/expected-swagger.json | 133 ++++++++++++--- .../Enabled/GeneratedSwagger/swagger.g.json | 133 ++++++++++++--- .../GeneratedSwagger/net6.0/swagger.g.json | 28 ++- .../GeneratedSwagger/net8.0/swagger.g.json | 28 ++- .../CamelCase/GeneratedSwagger/swagger.g.json | 70 ++++++-- .../KebabCase/GeneratedSwagger/swagger.g.json | 70 ++++++-- .../GeneratedSwagger/swagger.g.json | 70 ++++++-- .../GeneratedSwagger/swagger.g.json | 77 +++++++-- .../GeneratedSwagger/swagger.g.json | 49 ++++-- .../GeneratedSwagger/swagger.g.json | 49 ++++-- .../GeneratedSwagger/swagger.g.json | 49 ++++-- .../GeneratedSwagger/swagger.g.json | 49 ++++-- .../GeneratedSwagger/swagger.g.json | 63 ++++--- 127 files changed, 2657 insertions(+), 813 deletions(-) diff --git a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json index 381b46d9dc..ec11cc5262 100644 --- a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json +++ b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json @@ -5433,6 +5433,13 @@ "$ref": "#/components/schemas/relationshipsInCreatePersonRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5467,6 +5474,13 @@ "$ref": "#/components/schemas/relationshipsInCreateTagRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5501,6 +5515,13 @@ "$ref": "#/components/schemas/relationshipsInCreateTodoItemRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5514,6 +5535,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -5562,6 +5590,13 @@ "$ref": "#/components/schemas/relationshipsInUpdatePersonRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5601,6 +5636,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateTagRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5640,6 +5682,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateTodoItemRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6165,13 +6214,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -6200,6 +6242,13 @@ "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6222,6 +6271,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6862,13 +6918,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -6927,6 +6976,13 @@ "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6949,6 +7005,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7314,13 +7377,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -7379,6 +7435,13 @@ "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7401,6 +7464,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreatePersonRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreatePersonRequest.cs index c2693ba758..53efea7fcc 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreatePersonRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreatePersonRequest.cs @@ -46,6 +46,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.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 @@ -96,6 +112,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreatePersonRequest.CreateFromDiscriminatorValue); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreatePersonRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -109,6 +126,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTagRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTagRequest.cs index 9cebbc8622..284cb08d83 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTagRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTagRequest.cs @@ -46,6 +46,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.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 @@ -96,6 +112,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTagRequest.CreateFromDiscriminatorValue); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTagRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -109,6 +126,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTodoItemRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTodoItemRequest.cs index 5b11c516fb..fd46f3a896 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTodoItemRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTodoItemRequest.cs @@ -46,6 +46,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.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 @@ -96,6 +112,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTodoItemRequest.CreateFromDiscriminatorValue); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTodoItemRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -109,6 +126,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInResponse.cs index f784f5ed69..f05ab07050 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInResponse.cs @@ -15,6 +15,22 @@ public partial class DataInResponse : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetStringValue(); } }, }; } @@ -73,6 +90,7 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); writer.WriteStringValue("type", Type); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdatePersonRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdatePersonRequest.cs index 5f2b6f6de4..c3edfb0463 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdatePersonRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdatePersonRequest.cs @@ -62,6 +62,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.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 @@ -113,6 +129,7 @@ public virtual IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdatePersonRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdatePersonRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -127,6 +144,7 @@ public virtual void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTagRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTagRequest.cs index 825638dc78..4a7728a4fd 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTagRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTagRequest.cs @@ -62,6 +62,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.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 @@ -113,6 +129,7 @@ public virtual IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTagRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTagRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -127,6 +144,7 @@ public virtual void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTodoItemRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTodoItemRequest.cs index 9dea33ae87..a446414a96 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTodoItemRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTodoItemRequest.cs @@ -62,6 +62,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.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 @@ -113,6 +129,7 @@ public virtual IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTodoItemRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTodoItemRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -127,6 +144,7 @@ public virtual void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonDataInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonDataInResponse.cs index c41f814f3e..37677e82ff 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonDataInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaClientExample.GeneratedCode.Models.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 @@ -113,7 +97,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -128,7 +111,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInRequest.cs index 8ca94c002e..e548ec28ee 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInRequest.cs @@ -46,6 +46,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonResourceType? Type @@ -80,6 +96,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "id", n => { Id = n.GetStringValue(); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -92,6 +109,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInResponse.cs index 6fd4057360..1e1c3d5069 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInResponse.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagDataInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagDataInResponse.cs index c81102d32f..5f97c7fe8b 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagDataInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaClientExample.GeneratedCode.Models.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 @@ -113,7 +97,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -128,7 +111,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInRequest.cs index a81db15be6..03a8541c0f 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInRequest.cs @@ -46,6 +46,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagResourceType? Type @@ -80,6 +96,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "id", n => { Id = n.GetStringValue(); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -92,6 +109,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInResponse.cs index 740ee2fdfb..ee9a56c29b 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInResponse.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemDataInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemDataInResponse.cs index 0cccbf83ac..fc20828b12 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemDataInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaClientExample.GeneratedCode.Models.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 @@ -113,7 +97,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -128,7 +111,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInRequest.cs index 6c80452815..fc21eb4a85 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInRequest.cs @@ -46,6 +46,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemResourceType? Type @@ -80,6 +96,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "id", n => { Id = n.GetStringValue(); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -92,6 +109,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInResponse.cs index fa2ac9c18b..c7ac6d6ec1 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInResponse.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IResourceIdentity.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IResourceIdentity.cs index e7ff17f037..9528dc75f4 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IResourceIdentity.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IResourceIdentity.cs @@ -7,4 +7,5 @@ internal interface IResourceIdentity { string Type { get; set; } string Id { get; set; } + Meta Meta { get; set; } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceData.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceData.cs index 3fac097f24..746c696545 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceData.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceData.cs @@ -12,4 +12,7 @@ internal abstract class ResourceData : IResourceIdentity public string Type { get; set; } = null!; public abstract string Id { get; set; } + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceDataInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceDataInResponse.cs index d28740b2c2..a4f9d40888 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceDataInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceDataInResponse.cs @@ -23,7 +23,4 @@ internal sealed class ResourceDataInResponse : ResourceData // Non-required because the related controller may be unavailable when used in an include. [JsonPropertyName("links")] public ResourceLinks Links { get; set; } = null!; - - [JsonPropertyName("meta")] - public Meta Meta { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceIdentifierInRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceIdentifierInRequest.cs index 71700b66bc..b3f1e9f89a 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceIdentifierInRequest.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceIdentifierInRequest.cs @@ -21,4 +21,7 @@ internal class ResourceIdentifierInRequest : IResourceIdentity [MinLength(1)] [JsonPropertyName("lid")] public string Lid { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceIdentifierInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceIdentifierInResponse.cs index e9d06e5f96..d32630de9f 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceIdentifierInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceIdentifierInResponse.cs @@ -1,10 +1,12 @@ using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; +using JetBrains.Annotations; using JsonApiDotNetCore.Resources; namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; // ReSharper disable once UnusedTypeParameter +[UsedImplicitly(ImplicitUseTargetFlags.Members)] internal sealed class ResourceIdentifierInResponse : IResourceIdentity where TResource : IIdentifiable { @@ -15,4 +17,7 @@ internal sealed class ResourceIdentifierInResponse : IResourceIdentit [Required] [JsonPropertyName("id")] public string Id { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs index c7f0c8d4ae..3b99ebd43a 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs @@ -11,14 +11,17 @@ internal sealed class AbstractResourceDataSchemaGenerator { private static readonly Type ResourceDataAbstractType = typeof(ResourceData); + private readonly MetaSchemaGenerator _metaSchemaGenerator; private readonly JsonApiSchemaIdSelector _schemaIdSelector; private readonly IResourceGraph _resourceGraph; - public AbstractResourceDataSchemaGenerator(JsonApiSchemaIdSelector schemaIdSelector, IResourceGraph resourceGraph) + public AbstractResourceDataSchemaGenerator(MetaSchemaGenerator metaSchemaGenerator, JsonApiSchemaIdSelector schemaIdSelector, IResourceGraph resourceGraph) { + ArgumentGuard.NotNull(metaSchemaGenerator); ArgumentGuard.NotNull(schemaIdSelector); ArgumentGuard.NotNull(resourceGraph); + _metaSchemaGenerator = metaSchemaGenerator; _schemaIdSelector = schemaIdSelector; _resourceGraph = resourceGraph; } @@ -32,6 +35,8 @@ public OpenApiSchema GenerateSchema(SchemaRepository schemaRepository) return referenceSchema; } + OpenApiSchema referenceSchemaForMeta = _metaSchemaGenerator.GenerateSchema(schemaRepository); + var fullSchema = new OpenApiSchema { Required = new SortedSet([JsonApiPropertyName.Type]), @@ -42,7 +47,8 @@ public OpenApiSchema GenerateSchema(SchemaRepository schemaRepository) { MinLength = 1, Type = "string" - } + }, + [referenceSchemaForMeta.Reference.Id] = referenceSchemaForMeta.WrapInExtendedSchema() }, AdditionalPropertiesAllowed = false, Discriminator = new OpenApiDiscriminator diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs index 455ff77e6a..590251b68a 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs @@ -2,6 +2,7 @@ using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; +using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; @@ -9,7 +10,6 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; internal sealed class DataSchemaGenerator { -#if NET6_0 private static readonly string[] ResourceDataPropertyNamesInOrder = [ JsonApiPropertyName.Type, @@ -20,7 +20,6 @@ internal sealed class DataSchemaGenerator JsonApiPropertyName.Links, JsonApiPropertyName.Meta ]; -#endif private readonly SchemaGenerator _defaultSchemaGenerator; private readonly GenerationCacheSchemaGenerator _generationCacheSchemaGenerator; @@ -65,63 +64,68 @@ public DataSchemaGenerator(SchemaGenerator defaultSchemaGenerator, GenerationCac _resourceDocumentationReader = resourceDocumentationReader; } - public OpenApiSchema GenerateSchema(Type resourceDataConstructedType, SchemaRepository schemaRepository) + public OpenApiSchema GenerateSchema(Type dataSchemaType, SchemaRepository schemaRepository) { - ArgumentGuard.NotNull(resourceDataConstructedType); + ArgumentGuard.NotNull(dataSchemaType); ArgumentGuard.NotNull(schemaRepository); - if (schemaRepository.TryLookupByType(resourceDataConstructedType, out OpenApiSchema referenceSchemaForResourceData)) + if (schemaRepository.TryLookupByType(dataSchemaType, out OpenApiSchema referenceSchemaForData)) { - return referenceSchemaForResourceData; + return referenceSchemaForData; } - referenceSchemaForResourceData = _defaultSchemaGenerator.GenerateSchema(resourceDataConstructedType, schemaRepository); - OpenApiSchema fullSchemaForResourceData = schemaRepository.Schemas[referenceSchemaForResourceData.Reference.Id]; - fullSchemaForResourceData.AdditionalPropertiesAllowed = false; - - var resourceTypeInfo = ResourceTypeInfo.Create(resourceDataConstructedType, _resourceGraph); + var resourceTypeInfo = ResourceTypeInfo.Create(dataSchemaType, _resourceGraph); + ResourceType resourceType = resourceTypeInfo.ResourceType; - OpenApiSchema fullSchemaForDerivedType = fullSchemaForResourceData.UnwrapLastExtendedSchema(); - bool isRequestSchema = fullSchemaForDerivedType == fullSchemaForResourceData; + referenceSchemaForData = _defaultSchemaGenerator.GenerateSchema(dataSchemaType, schemaRepository); + OpenApiSchema fullSchemaForResourceData = schemaRepository.Schemas[referenceSchemaForData.Reference.Id]; + fullSchemaForResourceData.AdditionalPropertiesAllowed = false; - if (isRequestSchema) - { - bool hasAtomicOperationsEndpoint = _generationCacheSchemaGenerator.HasAtomicOperationsEndpoint(schemaRepository); - AdaptResourceIdentity(resourceTypeInfo, fullSchemaForResourceData, hasAtomicOperationsEndpoint); - SetResourceType(fullSchemaForResourceData, resourceTypeInfo.ResourceType, schemaRepository); - } + OpenApiSchema inlineSchemaForResourceData = fullSchemaForResourceData.UnwrapLastExtendedSchema(); + bool isRequestSchema = inlineSchemaForResourceData == fullSchemaForResourceData; - SetResourceId(fullSchemaForDerivedType, resourceTypeInfo.ResourceType, schemaRepository); + SetAbstract(inlineSchemaForResourceData, resourceType); + SetResourceType(inlineSchemaForResourceData, resourceType, schemaRepository); + AdaptResourceIdentity(inlineSchemaForResourceData, resourceTypeInfo, isRequestSchema, schemaRepository); + SetResourceId(inlineSchemaForResourceData, resourceType, schemaRepository); + SetResourceFields(inlineSchemaForResourceData, resourceTypeInfo, isRequestSchema, schemaRepository); + SetDocumentation(fullSchemaForResourceData, resourceType); + SetLinksVisibility(inlineSchemaForResourceData, resourceTypeInfo, schemaRepository); - fullSchemaForResourceData.Description = _resourceDocumentationReader.GetDocumentationForType(resourceTypeInfo.ResourceType); + inlineSchemaForResourceData.ReorderProperties(ResourceDataPropertyNamesInOrder); - var fieldSchemaBuilder = new ResourceFieldSchemaBuilder(_defaultSchemaGenerator, _resourceIdentifierSchemaGenerator, _linksVisibilitySchemaGenerator, - _resourceFieldValidationMetadataProvider, _relationshipTypeFactory, resourceTypeInfo); + return referenceSchemaForData; + } - if (fullSchemaForDerivedType.Properties.ContainsKey(JsonApiPropertyName.Attributes)) + private static void SetAbstract(OpenApiSchema fullSchema, ResourceType resourceType) + { + if (resourceType.ClrType.IsAbstract) { - SetResourceAttributes(fullSchemaForDerivedType, isRequestSchema, fieldSchemaBuilder, schemaRepository); + fullSchema.Extensions["x-abstract"] = new OpenApiBoolean(true); } + } - if (fullSchemaForDerivedType.Properties.ContainsKey(JsonApiPropertyName.Relationships)) + private void SetResourceType(OpenApiSchema fullSchema, ResourceType resourceType, SchemaRepository schemaRepository) + { + if (fullSchema.Properties.ContainsKey(JsonApiPropertyName.Type)) { - SetResourceRelationships(fullSchemaForDerivedType, isRequestSchema, fieldSchemaBuilder, schemaRepository); + OpenApiSchema referenceSchema = _resourceTypeSchemaGenerator.GenerateSchema(resourceType, schemaRepository); + fullSchema.Properties[JsonApiPropertyName.Type] = referenceSchema.WrapInExtendedSchema(); } - - _linksVisibilitySchemaGenerator.UpdateSchemaForResource(resourceTypeInfo, fullSchemaForDerivedType, schemaRepository); - -#if NET6_0 - fullSchemaForDerivedType.ReorderProperties(ResourceDataPropertyNamesInOrder); -#endif - - return referenceSchemaForResourceData; } - private void AdaptResourceIdentity(ResourceTypeInfo resourceTypeInfo, OpenApiSchema fullSchemaForResourceData, bool hasAtomicOperationsEndpoint) + private void AdaptResourceIdentity(OpenApiSchema fullSchema, ResourceTypeInfo resourceTypeInfo, bool forRequestSchema, SchemaRepository schemaRepository) { + if (!forRequestSchema) + { + return; + } + + bool hasAtomicOperationsEndpoint = _generationCacheSchemaGenerator.HasAtomicOperationsEndpoint(schemaRepository); + if (!hasAtomicOperationsEndpoint) { - fullSchemaForResourceData.Properties.Remove(JsonApiPropertyName.Lid); + fullSchema.Properties.Remove(JsonApiPropertyName.Lid); } if (resourceTypeInfo.ResourceDataOpenType == typeof(DataInCreateResourceRequest<>)) @@ -132,23 +136,23 @@ private void AdaptResourceIdentity(ResourceTypeInfo resourceTypeInfo, OpenApiSch { if (clientIdGeneration == ClientIdGenerationMode.Forbidden) { - fullSchemaForResourceData.Properties.Remove(JsonApiPropertyName.Id); + fullSchema.Properties.Remove(JsonApiPropertyName.Id); } else if (clientIdGeneration == ClientIdGenerationMode.Required) { - fullSchemaForResourceData.Properties.Remove(JsonApiPropertyName.Lid); - fullSchemaForResourceData.Required.Add(JsonApiPropertyName.Id); + fullSchema.Properties.Remove(JsonApiPropertyName.Lid); + fullSchema.Required.Add(JsonApiPropertyName.Id); } } else { if (clientIdGeneration == ClientIdGenerationMode.Forbidden) { - fullSchemaForResourceData.Properties.Remove(JsonApiPropertyName.Id); + fullSchema.Properties.Remove(JsonApiPropertyName.Id); } else if (clientIdGeneration == ClientIdGenerationMode.Required) { - fullSchemaForResourceData.Required.Add(JsonApiPropertyName.Id); + fullSchema.Required.Add(JsonApiPropertyName.Id); } } } @@ -156,59 +160,70 @@ private void AdaptResourceIdentity(ResourceTypeInfo resourceTypeInfo, OpenApiSch { if (!hasAtomicOperationsEndpoint) { - fullSchemaForResourceData.Required.Add(JsonApiPropertyName.Id); + fullSchema.Required.Add(JsonApiPropertyName.Id); } } } - private void SetResourceType(OpenApiSchema fullSchemaForResourceData, ResourceType resourceType, SchemaRepository schemaRepository) + private void SetResourceId(OpenApiSchema fullSchema, ResourceType resourceType, SchemaRepository schemaRepository) { - OpenApiSchema referenceSchema = _resourceTypeSchemaGenerator.GenerateSchema(resourceType, schemaRepository); - fullSchemaForResourceData.Properties[JsonApiPropertyName.Type] = referenceSchema.WrapInExtendedSchema(); - } - - private void SetResourceId(OpenApiSchema fullSchemaForResourceData, ResourceType resourceType, SchemaRepository schemaRepository) - { - if (fullSchemaForResourceData.Properties.ContainsKey(JsonApiPropertyName.Id)) + if (fullSchema.Properties.ContainsKey(JsonApiPropertyName.Id)) { OpenApiSchema idSchema = _resourceIdSchemaGenerator.GenerateSchema(resourceType, schemaRepository); - fullSchemaForResourceData.Properties[JsonApiPropertyName.Id] = idSchema; + fullSchema.Properties[JsonApiPropertyName.Id] = idSchema; } } - private void SetResourceAttributes(OpenApiSchema fullSchemaForResourceData, bool forRequestSchema, ResourceFieldSchemaBuilder builder, - SchemaRepository schemaRepository) + private void SetResourceFields(OpenApiSchema fullSchemaForData, ResourceTypeInfo resourceTypeInfo, bool forRequestSchema, SchemaRepository schemaRepository) { - OpenApiSchema referenceSchemaForAttributes = fullSchemaForResourceData.Properties[JsonApiPropertyName.Attributes].UnwrapLastExtendedSchema(); - OpenApiSchema fullSchemaForAttributes = schemaRepository.Schemas[referenceSchemaForAttributes.Reference.Id]; - - builder.SetMembersOfAttributes(fullSchemaForAttributes, forRequestSchema, schemaRepository); + bool schemaHasFields = fullSchemaForData.Properties.ContainsKey(JsonApiPropertyName.Attributes) && + fullSchemaForData.Properties.ContainsKey(JsonApiPropertyName.Relationships); - if (fullSchemaForAttributes.Properties.Count == 0) - { - fullSchemaForResourceData.Properties.Remove(JsonApiPropertyName.Attributes); - } - else + if (schemaHasFields) { - fullSchemaForAttributes.AdditionalPropertiesAllowed = false; + var fieldSchemaBuilder = new ResourceFieldSchemaBuilder(_defaultSchemaGenerator, _resourceIdentifierSchemaGenerator, + _linksVisibilitySchemaGenerator, _resourceFieldValidationMetadataProvider, _relationshipTypeFactory, resourceTypeInfo); + + ResourceType resourceType = resourceTypeInfo.ResourceType; + + SetFieldSchemaMembers(fullSchemaForData, resourceType, forRequestSchema, true, fieldSchemaBuilder, schemaRepository); + SetFieldSchemaMembers(fullSchemaForData, resourceType, forRequestSchema, false, fieldSchemaBuilder, schemaRepository); } } - private void SetResourceRelationships(OpenApiSchema fullSchemaForResourceData, bool forRequestSchema, ResourceFieldSchemaBuilder builder, - SchemaRepository schemaRepository) + private void SetFieldSchemaMembers(OpenApiSchema fullSchemaForData, ResourceType resourceType, bool forRequestSchema, bool forAttributes, + ResourceFieldSchemaBuilder fieldSchemaBuilder, SchemaRepository schemaRepository) { - OpenApiSchema referenceSchemaForRelationships = fullSchemaForResourceData.Properties[JsonApiPropertyName.Relationships].UnwrapLastExtendedSchema(); - OpenApiSchema fullSchemaForRelationships = schemaRepository.Schemas[referenceSchemaForRelationships.Reference.Id]; + string propertyNameInSchema = forAttributes ? JsonApiPropertyName.Attributes : JsonApiPropertyName.Relationships; - builder.SetMembersOfRelationships(fullSchemaForRelationships, forRequestSchema, schemaRepository); + OpenApiSchema referenceSchemaForFields = fullSchemaForData.Properties[propertyNameInSchema].UnwrapLastExtendedSchema(); + OpenApiSchema fullSchemaForFields = schemaRepository.Schemas[referenceSchemaForFields.Reference.Id]; + fullSchemaForFields.AdditionalPropertiesAllowed = false; - if (fullSchemaForRelationships.Properties.Count == 0) + SetAbstract(fullSchemaForFields, resourceType); + + if (forAttributes) { - fullSchemaForResourceData.Properties.Remove(JsonApiPropertyName.Relationships); + fieldSchemaBuilder.SetMembersOfAttributes(fullSchemaForFields, forRequestSchema, schemaRepository); } else { - fullSchemaForRelationships.AdditionalPropertiesAllowed = false; + fieldSchemaBuilder.SetMembersOfRelationships(fullSchemaForFields, forRequestSchema, schemaRepository); } + + if (fullSchemaForFields.Properties.Count == 0) + { + fullSchemaForData.Properties.Remove(propertyNameInSchema); + } + } + + private void SetDocumentation(OpenApiSchema fullSchema, ResourceType resourceType) + { + fullSchema.Description = _resourceDocumentationReader.GetDocumentationForType(resourceType); + } + + private void SetLinksVisibility(OpenApiSchema fullSchema, ResourceTypeInfo resourceTypeInfo, SchemaRepository schemaRepository) + { + _linksVisibilitySchemaGenerator.UpdateSchemaForResource(resourceTypeInfo, fullSchema, schemaRepository); } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipIdentifierSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipIdentifierSchemaGenerator.cs index dff37a0b11..86cc826319 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipIdentifierSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipIdentifierSchemaGenerator.cs @@ -70,6 +70,8 @@ public OpenApiSchema GenerateSchema(RelationshipAttribute relationship, SchemaRe OpenApiSchema referenceSchemaForIdentifier = _defaultSchemaGenerator.GenerateSchema(relationshipIdentifierConstructedType, schemaRepository); OpenApiSchema fullSchemaForIdentifier = schemaRepository.Schemas[referenceSchemaForIdentifier.Reference.Id]; + fullSchemaForIdentifier.Properties.Remove(JsonApiPropertyName.Meta); + SetResourceType(fullSchemaForIdentifier, relationship.LeftType, schemaRepository); SetResourceId(fullSchemaForIdentifier, relationship.LeftType, schemaRepository); SetRelationship(fullSchemaForIdentifier, relationship, schemaRepository); diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseDataInResponse.cs index e4f8accfdc..d37a482198 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseDataInResponse.cs @@ -49,22 +49,6 @@ public Guid? Id 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 global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.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 @@ -103,7 +87,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -118,7 +101,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInRequest.cs index 3e660ae17b..51e411f85f 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInRequest.cs @@ -36,6 +36,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseResourceType? Type @@ -70,6 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "id", n => { Id = n.GetGuidValue(); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -82,6 +99,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteGuidValue("id", Id); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInResponse.cs index 0b2667aad3..7077d9f5e1 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInResponse.cs @@ -21,6 +21,22 @@ public Guid? Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseResourceType? Type { @@ -53,6 +69,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -64,6 +81,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateCourseRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateCourseRequest.cs index 41503ab735..c70efa0b38 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateCourseRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateCourseRequest.cs @@ -37,6 +37,22 @@ public Guid? Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.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 @@ -86,6 +102,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateCourseRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateCourseRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -99,6 +116,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateEnrollmentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateEnrollmentRequest.cs index 42dbf02374..5dc96eb3da 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateEnrollmentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateEnrollmentRequest.cs @@ -46,6 +46,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.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 @@ -96,6 +112,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateEnrollmentRequest.CreateFromDiscriminatorValue); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateEnrollmentRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -109,6 +126,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateStudentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateStudentRequest.cs index bf552f6818..1c70762160 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateStudentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateStudentRequest.cs @@ -46,6 +46,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.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 @@ -96,6 +112,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateStudentRequest.CreateFromDiscriminatorValue); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateStudentRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -109,6 +126,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateTeacherRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateTeacherRequest.cs index 27b7b855fa..12799c3e51 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateTeacherRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateTeacherRequest.cs @@ -46,6 +46,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.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 @@ -96,6 +112,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateTeacherRequest.CreateFromDiscriminatorValue); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateTeacherRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -109,6 +126,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInResponse.cs index 135ab1efee..52a2999665 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInResponse.cs @@ -15,6 +15,22 @@ public partial class DataInResponse : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable @@ -64,6 +80,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetStringValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); writer.WriteStringValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateCourseRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateCourseRequest.cs index 3db9c88ad0..66f0675412 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateCourseRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateCourseRequest.cs @@ -52,6 +52,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.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 @@ -103,6 +119,7 @@ public virtual IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateCourseRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateCourseRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -117,6 +134,7 @@ public virtual void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateEnrollmentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateEnrollmentRequest.cs index b20186e4a9..1d6e6daebd 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateEnrollmentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateEnrollmentRequest.cs @@ -62,6 +62,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.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 @@ -113,6 +129,7 @@ public virtual IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateEnrollmentRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateEnrollmentRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -127,6 +144,7 @@ public virtual void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateStudentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateStudentRequest.cs index ca4e4a8ae9..96e5f5a287 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateStudentRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateStudentRequest.cs @@ -62,6 +62,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.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 @@ -113,6 +129,7 @@ public virtual IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateStudentRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateStudentRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -127,6 +144,7 @@ public virtual void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateTeacherRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateTeacherRequest.cs index 7d557d8b87..97cd1f410d 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateTeacherRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateTeacherRequest.cs @@ -62,6 +62,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.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 @@ -113,6 +129,7 @@ public virtual IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateTeacherRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateTeacherRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -127,6 +144,7 @@ public virtual void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentDataInResponse.cs index e9d63697e5..4879f32019 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.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 @@ -113,7 +97,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -128,7 +111,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInRequest.cs index 4b858b40b7..cbc2b7ca62 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInRequest.cs @@ -46,6 +46,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentResourceType? Type @@ -80,6 +96,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "id", n => { Id = n.GetStringValue(); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -92,6 +109,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInResponse.cs index 1cebbf6ad5..182dd60f98 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInResponse.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentDataInResponse.cs index 9a827a596b..87f942e8a9 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.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 @@ -113,7 +97,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -128,7 +111,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInRequest.cs index 005bd9e9d7..ad1d321a87 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInRequest.cs @@ -46,6 +46,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentResourceType? Type @@ -80,6 +96,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "id", n => { Id = n.GetStringValue(); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -92,6 +109,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInResponse.cs index 2ffb34a898..d46136c632 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInResponse.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherDataInResponse.cs index 8818a478c5..b4cf5b1313 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.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 @@ -113,7 +97,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -128,7 +111,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInRequest.cs index 9312c0d803..071d5e97b9 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInRequest.cs @@ -46,6 +46,22 @@ public string Lid get { return BackingStore?.Get("lid"); } set { BackingStore?.Set("lid", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherResourceType? Type @@ -80,6 +96,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "id", n => { Id = n.GetStringValue(); } }, { "lid", n => { Lid = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -92,6 +109,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInResponse.cs index 806ed68a0e..480327a316 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInResponse.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreateGameRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreateGameRequest.cs index 07b911c73e..e2577f7b59 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreateGameRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreateGameRequest.cs @@ -37,6 +37,22 @@ public Guid? Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameResourceType? Type { @@ -70,6 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateGameRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -82,6 +99,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerGroupRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerGroupRequest.cs index 6a582d014e..7086ff3454 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerGroupRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerGroupRequest.cs @@ -31,6 +31,22 @@ public partial class DataInCreatePlayerGroupRequest : IBackedModel, IParsable #endif /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.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 @@ -79,6 +95,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerGroupRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerGroupRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -91,6 +108,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerRequest.cs index a31e9cf415..1ba5370819 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerRequest.cs @@ -37,6 +37,22 @@ public Guid? Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.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 @@ -86,6 +102,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -99,6 +116,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInResponse.cs index 3acc398a68..b64ad60d33 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInResponse.cs @@ -15,6 +15,22 @@ public partial class DataInResponse : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetStringValue(); } }, }; } @@ -73,6 +90,7 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); writer.WriteStringValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameDataInResponse.cs index f2d9653429..01e6ecb905 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameDataInResponse.cs @@ -49,22 +49,6 @@ public Guid? Id 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 global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.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 @@ -87,7 +71,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -101,7 +84,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInRequest.cs index 34113b30ec..4f59cba8b7 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInRequest.cs @@ -21,6 +21,22 @@ public Guid? Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameResourceType? Type { @@ -53,6 +69,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -64,6 +81,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInResponse.cs index 5f404d0230..d1d85931d0 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInResponse.cs @@ -21,6 +21,22 @@ public Guid? Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameResourceType? Type { @@ -53,6 +69,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -64,6 +81,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerDataInResponse.cs index 73f34bcc53..2d4f04c104 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerDataInResponse.cs @@ -49,22 +49,6 @@ public Guid? Id 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 global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.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 @@ -103,7 +87,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -118,7 +101,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); 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 3a799b3dcd..7610ac3f15 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.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 @@ -113,7 +97,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -128,7 +111,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInRequest.cs index c0f80fbf81..52d46b505f 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInRequest.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInResponse.cs index d974132a31..8decacaf98 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInResponse.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInRequest.cs index e3a9aeb9a3..97c8cab245 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInRequest.cs @@ -21,6 +21,22 @@ public Guid? Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerResourceType? Type { @@ -53,6 +69,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -64,6 +81,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInResponse.cs index 919d20f5ab..639b44a01a 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInResponse.cs @@ -21,6 +21,22 @@ public Guid? Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerResourceType? Type { @@ -53,6 +69,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -64,6 +81,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryDataInResponse.cs index ecfa629358..84adcb014f 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryDataInResponse.cs @@ -49,22 +49,6 @@ public Guid? Id 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 global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.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 @@ -103,7 +87,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -118,7 +101,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCreateCountryRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCreateCountryRequest.cs index 7dfb3abf5e..cfc3b15ac4 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCreateCountryRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCreateCountryRequest.cs @@ -31,6 +31,22 @@ public partial class DataInCreateCountryRequest : IBackedModel, IParsable #endif /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.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 @@ -79,6 +95,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateCountryRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateCountryRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -91,6 +108,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInResponse.cs index e1a06a7644..6ed79aade8 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInResponse.cs @@ -15,6 +15,22 @@ public partial class DataInResponse : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable @@ -62,6 +78,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetStringValue(); } }, }; } @@ -72,6 +89,7 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); writer.WriteStringValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInUpdateCountryRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInUpdateCountryRequest.cs index 775e4aea4e..e2b312c808 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInUpdateCountryRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInUpdateCountryRequest.cs @@ -37,6 +37,22 @@ public Guid? Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.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 @@ -86,6 +102,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateCountryRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateCountryRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -99,6 +116,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageDataInResponse.cs index df4d66d17c..db67e3a53f 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageDataInResponse.cs @@ -49,22 +49,6 @@ public Guid? Id 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 global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.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 @@ -87,7 +71,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -101,7 +84,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInRequest.cs index 6518d9b0cb..5e1a01ce35 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInRequest.cs @@ -21,6 +21,22 @@ public Guid? Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageResourceType? Type { @@ -53,6 +69,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -64,6 +81,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInResponse.cs index 0a5be7be6e..a421e0aca1 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInResponse.cs @@ -21,6 +21,22 @@ public Guid? Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageResourceType? Type { @@ -53,6 +69,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -64,6 +81,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInResponse.cs index 0e7793c2b3..e07db96af2 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.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 @@ -97,7 +81,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -111,7 +94,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInRequest.cs index c0365e45e9..d080e9e629 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInRequest.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInResponse.cs index 1d9bee6123..1b1df3c216 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInResponse.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateAccommodationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateAccommodationRequest.cs index cc9daafd0b..b8588ab5c1 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateAccommodationRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateAccommodationRequest.cs @@ -31,6 +31,22 @@ public partial class DataInCreateAccommodationRequest : IBackedModel, IParsable #endif /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationResourceType? Type { @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateAccommodationRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateExcursionRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateExcursionRequest.cs index afc004fa07..062b05a130 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateExcursionRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateExcursionRequest.cs @@ -31,6 +31,22 @@ public partial class DataInCreateExcursionRequest : IBackedModel, IParsable #endif /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionResourceType? Type { @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateExcursionRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateTransportRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateTransportRequest.cs index 9144c17408..865feaa5e7 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateTransportRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateTransportRequest.cs @@ -31,6 +31,22 @@ public partial class DataInCreateTransportRequest : IBackedModel, IParsable #endif /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportResourceType? Type { @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateTransportRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateVacationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateVacationRequest.cs index 0c5b3ade23..b8cf5fb5b2 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateVacationRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateVacationRequest.cs @@ -31,6 +31,22 @@ public partial class DataInCreateVacationRequest : IBackedModel, IParsable #endif /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.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 @@ -79,6 +95,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateVacationRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateVacationRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -91,6 +108,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInResponse.cs index 9f066f663d..2b631857ba 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInResponse.cs @@ -15,6 +15,22 @@ public partial class DataInResponse : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable @@ -64,6 +80,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetStringValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); writer.WriteStringValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateAccommodationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateAccommodationRequest.cs index fe538510e5..c09a67e879 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateAccommodationRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateAccommodationRequest.cs @@ -46,6 +46,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationResourceType? Type @@ -80,6 +96,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateAccommodationRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -92,6 +109,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateExcursionRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateExcursionRequest.cs index eeb761f2d2..012c592825 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateExcursionRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateExcursionRequest.cs @@ -46,6 +46,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionResourceType? Type @@ -80,6 +96,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateExcursionRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -92,6 +109,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateTransportRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateTransportRequest.cs index 4b01354c84..a3b3fa9ae6 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateTransportRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateTransportRequest.cs @@ -46,6 +46,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportResourceType? Type @@ -80,6 +96,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateTransportRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -92,6 +109,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateVacationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateVacationRequest.cs index 408a597bfe..c42de5deeb 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateVacationRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateVacationRequest.cs @@ -46,6 +46,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.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 @@ -96,6 +112,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateVacationRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateVacationRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -109,6 +126,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInResponse.cs index 3e0eaf8179..60260f19ed 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.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 @@ -97,7 +81,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -111,7 +94,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInRequest.cs index a67480a93e..9cf851caf3 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInRequest.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInResponse.cs index dc08ab2e2e..490f6d817a 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInResponse.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInResponse.cs index 184ee1330a..74319c7f6f 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.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 @@ -97,7 +81,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -111,7 +94,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInRequest.cs index 851ffd9e9a..405ec4ab6d 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInRequest.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInResponse.cs index 677cf588d7..2b52c04b4a 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInResponse.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInResponse.cs index 5c6ce8c0f0..e4d3d04966 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.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 @@ -113,7 +97,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -128,7 +111,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInCreateSocialMediaAccountRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInCreateSocialMediaAccountRequest.cs index 67521fb384..c805916269 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInCreateSocialMediaAccountRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInCreateSocialMediaAccountRequest.cs @@ -31,6 +31,22 @@ public partial class DataInCreateSocialMediaAccountRequest : IBackedModel, IPars #endif /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountResourceType? Type { @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateSocialMediaAccountRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInResponse.cs index 7df53fffe7..5e083e3df9 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInResponse.cs @@ -15,6 +15,22 @@ public partial class DataInResponse : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable @@ -61,6 +77,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetStringValue(); } }, }; } @@ -71,6 +88,7 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); writer.WriteStringValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInUpdateSocialMediaAccountRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInUpdateSocialMediaAccountRequest.cs index d85fb500f9..3aeb12805e 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInUpdateSocialMediaAccountRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInUpdateSocialMediaAccountRequest.cs @@ -37,6 +37,22 @@ public Guid? Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountResourceType? Type { @@ -70,6 +86,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateSocialMediaAccountRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -82,6 +99,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountDataInResponse.cs index 8704118180..013ed6923d 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountDataInResponse.cs @@ -49,22 +49,6 @@ public Guid? Id 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 global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.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 @@ -87,7 +71,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.SocialMediaAccountAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetGuidValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -101,7 +84,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteGuidValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNameValuePairRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNameValuePairRequest.cs index b5a55232da..c9331e369e 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNameValuePairRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNameValuePairRequest.cs @@ -31,6 +31,22 @@ public partial class DataInCreateNameValuePairRequest : IBackedModel, IParsable #endif /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.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 @@ -79,6 +95,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNameValuePairRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNameValuePairRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -91,6 +108,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNodeRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNodeRequest.cs index 1c971ca246..1d084032fa 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNodeRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNodeRequest.cs @@ -31,6 +31,22 @@ public partial class DataInCreateNodeRequest : IBackedModel, IParsable #endif /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.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 @@ -79,6 +95,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNodeRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNodeRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -91,6 +108,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInResponse.cs index 1d423f094d..56a96e996d 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInResponse.cs @@ -15,6 +15,22 @@ public partial class DataInResponse : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable @@ -62,6 +78,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetStringValue(); } }, }; } @@ -72,6 +89,7 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); writer.WriteStringValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNameValuePairRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNameValuePairRequest.cs index 0e18baf4b4..cf33489d86 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNameValuePairRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNameValuePairRequest.cs @@ -46,6 +46,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.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 @@ -96,6 +112,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNameValuePairRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNameValuePairRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -109,6 +126,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNodeRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNodeRequest.cs index 44de71e349..cb3f3a3990 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNodeRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNodeRequest.cs @@ -46,6 +46,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.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 @@ -96,6 +112,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNodeRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNodeRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -109,6 +126,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairDataInResponse.cs index e4a80b0b74..6e73ee7a0d 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.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 @@ -113,7 +97,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -128,7 +111,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInRequest.cs index 7aee410382..579fa1bd17 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInRequest.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInResponse.cs index a03260ecc8..00c505b4d2 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInResponse.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeDataInResponse.cs index 4fa2619f07..8ea29a2d81 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.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 @@ -113,7 +97,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -128,7 +111,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInRequest.cs index baf5834c96..55174b2263 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInRequest.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInResponse.cs index 29a5eadd36..f7433ece29 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInResponse.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInCreateWriteOnlyChannelRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInCreateWriteOnlyChannelRequest.cs index 4cc960699e..b0fff4d0e0 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInCreateWriteOnlyChannelRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInCreateWriteOnlyChannelRequest.cs @@ -31,6 +31,22 @@ public partial class DataInCreateWriteOnlyChannelRequest : IBackedModel, IParsab #endif /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.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 @@ -79,6 +95,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateWriteOnlyChannelRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateWriteOnlyChannelRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -91,6 +108,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInResponse.cs index b4d8c5d09c..f09e4494a4 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInResponse.cs @@ -15,6 +15,22 @@ public partial class DataInResponse : IBackedModel, IParsable { /// Stores model information. public IBackingStore BackingStore { get; private set; } + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#endif /// The type property #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER #nullable enable @@ -64,6 +80,7 @@ public virtual IDictionary> GetFieldDeserializers() { return new Dictionary> { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetStringValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual IDictionary> GetFieldDeserializers() public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); writer.WriteStringValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInUpdateWriteOnlyChannelRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInUpdateWriteOnlyChannelRequest.cs index 6af7c96ee6..062740df20 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInUpdateWriteOnlyChannelRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInUpdateWriteOnlyChannelRequest.cs @@ -46,6 +46,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.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 @@ -96,6 +112,7 @@ public virtual IDictionary> GetFieldDeserializers() { { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateWriteOnlyChannelRequest.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateWriteOnlyChannelRequest.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; @@ -109,6 +126,7 @@ public virtual void Serialize(ISerializationWriter writer) _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); writer.WriteEnumValue("type", Type); } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamDataInResponse.cs index ee493940ed..6f97046426 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.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 @@ -97,7 +81,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -111,7 +94,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInRequest.cs index 9bad71bf0a..d893dd50ac 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInRequest.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInResponse.cs index ae7d4d6651..f9590cdddb 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInResponse.cs @@ -30,6 +30,22 @@ public string Id get { return BackingStore?.Get("id"); } set { BackingStore?.Set("id", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// The type property public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamResourceType? Type @@ -63,6 +79,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "type", n => { Type = n.GetEnumValue(); } }, }; } @@ -74,6 +91,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); writer.WriteEnumValue("type", Type); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelDataInResponse.cs index 55e3417cfd..7f424f6bb8 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.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 @@ -113,7 +97,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -128,7 +111,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelDataInResponse.cs index fb479548f8..0eca201e8b 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.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 @@ -113,7 +97,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -128,7 +111,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelDataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelDataInResponse.cs index 163faa2b3d..bedcf72014 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelDataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/WriteOnlyChannelDataInResponse.cs @@ -59,22 +59,6 @@ public string Id 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 global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta - { - get { return BackingStore?.Get("meta"); } - set { BackingStore?.Set("meta", value); } - } -#nullable restore -#else - public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.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 @@ -113,7 +97,6 @@ public override IDictionary> GetFieldDeserializers() { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelAttributesInResponse.CreateFromDiscriminatorValue); } }, { "id", n => { Id = n.GetStringValue(); } }, { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, - { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.WriteOnlyChannelRelationshipsInResponse.CreateFromDiscriminatorValue); } }, }; } @@ -128,7 +111,6 @@ public override void Serialize(ISerializationWriter writer) writer.WriteObjectValue("attributes", Attributes); writer.WriteStringValue("id", Id); writer.WriteObjectValue("links", Links); - writer.WriteObjectValue("meta", Meta); writer.WriteObjectValue("relationships", Relationships); } } diff --git a/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json index 42596a0e47..51f41a2f7a 100644 --- a/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json @@ -6790,13 +6790,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -6901,6 +6894,13 @@ "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6923,6 +6923,13 @@ "minLength": 1, "type": "string", "format": "uuid" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7342,6 +7349,13 @@ "$ref": "#/components/schemas/relationshipsInCreateCourseRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7376,6 +7390,13 @@ "$ref": "#/components/schemas/relationshipsInCreateEnrollmentRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7410,6 +7431,13 @@ "$ref": "#/components/schemas/relationshipsInCreateStudentRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7444,6 +7472,13 @@ "$ref": "#/components/schemas/relationshipsInCreateTeacherRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7457,6 +7492,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -7506,6 +7548,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateCourseRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7545,6 +7594,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateEnrollmentRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7584,6 +7640,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateStudentRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7623,6 +7686,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateTeacherRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7860,13 +7930,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -7932,6 +7995,13 @@ "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7954,6 +8024,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8898,13 +8975,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -9009,6 +9079,13 @@ "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -9031,6 +9108,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -9318,13 +9402,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -9390,6 +9467,13 @@ "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -9412,6 +9496,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/AtomicOperations/OperationsTests.cs b/test/OpenApiTests/AtomicOperations/OperationsTests.cs index ad10cc6f2d..95eee0df56 100644 --- a/test/OpenApiTests/AtomicOperations/OperationsTests.cs +++ b/test/OpenApiTests/AtomicOperations/OperationsTests.cs @@ -389,6 +389,13 @@ public async Task Course_operation_component_schemas_are_exposed() "$ref": "#/components/schemas/relationshipsInCreateCourseRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -515,6 +522,13 @@ public async Task Course_operation_component_schemas_are_exposed() "$ref": "#/components/schemas/relationshipsInUpdateCourseRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -707,6 +721,13 @@ public async Task Course_operation_component_schemas_are_exposed() "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -834,6 +855,13 @@ public async Task Student_operation_component_schemas_are_exposed() "$ref": "#/components/schemas/relationshipsInCreateStudentRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -960,6 +988,13 @@ public async Task Student_operation_component_schemas_are_exposed() "$ref": "#/components/schemas/relationshipsInUpdateStudentRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1201,6 +1236,13 @@ public async Task Student_operation_component_schemas_are_exposed() "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1373,6 +1415,13 @@ public async Task Teacher_operation_component_schemas_are_exposed() "$ref": "#/components/schemas/relationshipsInCreateTeacherRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1499,6 +1548,13 @@ public async Task Teacher_operation_component_schemas_are_exposed() "$ref": "#/components/schemas/relationshipsInUpdateTeacherRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1729,6 +1785,13 @@ public async Task Teacher_operation_component_schemas_are_exposed() "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1856,6 +1919,13 @@ public async Task Enrollment_operation_component_schemas_are_exposed() "$ref": "#/components/schemas/relationshipsInCreateEnrollmentRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1985,6 +2055,13 @@ public async Task Enrollment_operation_component_schemas_are_exposed() "$ref": "#/components/schemas/relationshipsInUpdateEnrollmentRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -2134,6 +2211,13 @@ public async Task Enrollment_operation_component_schemas_are_exposed() "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json index b70da46c83..f84604871d 100644 --- a/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json @@ -447,6 +447,13 @@ "$ref": "#/components/schemas/attributesInCreateGameRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -477,6 +484,13 @@ "$ref": "#/components/schemas/relationshipsInCreatePlayerGroupRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -513,6 +527,13 @@ "$ref": "#/components/schemas/relationshipsInCreatePlayerRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -526,6 +547,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -703,13 +731,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -735,6 +756,13 @@ "minLength": 1, "type": "string", "format": "uuid" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -757,6 +785,13 @@ "minLength": 1, "type": "string", "format": "uuid" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -855,13 +890,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -914,13 +942,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -946,6 +967,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -968,6 +996,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1046,6 +1081,13 @@ "minLength": 1, "type": "string", "format": "uuid" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1068,6 +1110,13 @@ "minLength": 1, "type": "string", "format": "uuid" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json index 679f1be432..78c3b8136b 100644 --- a/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json @@ -1264,13 +1264,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -1376,6 +1369,13 @@ "$ref": "#/components/schemas/relationshipsInCreateCountryRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1389,6 +1389,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -1433,6 +1440,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateCountryRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1636,13 +1650,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -1698,6 +1705,13 @@ "minLength": 1, "type": "string", "format": "uuid" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1720,6 +1734,13 @@ "minLength": 1, "type": "string", "format": "uuid" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json index 4484ec1665..3f060da59f 100644 --- a/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json @@ -5997,13 +5997,6 @@ "$ref": "#/components/schemas/resource-links" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -6320,6 +6313,13 @@ "$ref": "#/components/schemas/relationships-in-create-airplane-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6350,6 +6350,13 @@ "$ref": "#/components/schemas/relationships-in-create-flight-attendant-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6373,6 +6380,13 @@ "$ref": "#/components/schemas/relationships-in-create-flight-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6396,6 +6410,13 @@ "$ref": "#/components/schemas/attributes-in-create-passenger-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6409,6 +6430,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -6453,6 +6481,13 @@ "$ref": "#/components/schemas/relationships-in-update-airplane-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6487,6 +6522,13 @@ "$ref": "#/components/schemas/relationships-in-update-flight-attendant-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6521,6 +6563,13 @@ "$ref": "#/components/schemas/relationships-in-update-flight-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6548,6 +6597,13 @@ "$ref": "#/components/schemas/attributes-in-update-passenger-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6783,13 +6839,6 @@ "$ref": "#/components/schemas/resource-links" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -6850,6 +6899,13 @@ }, "id": { "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6870,6 +6926,13 @@ }, "id": { "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7141,13 +7204,6 @@ "$ref": "#/components/schemas/resource-links" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -7208,6 +7264,13 @@ }, "id": { "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7228,6 +7291,13 @@ }, "id": { "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7566,13 +7636,6 @@ "$ref": "#/components/schemas/resource-links" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -7633,6 +7696,13 @@ }, "id": { "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7653,6 +7723,13 @@ }, "id": { "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/LegacyOpenApi/expected-swagger.json b/test/OpenApiTests/LegacyOpenApi/expected-swagger.json index 4484ec1665..3f060da59f 100644 --- a/test/OpenApiTests/LegacyOpenApi/expected-swagger.json +++ b/test/OpenApiTests/LegacyOpenApi/expected-swagger.json @@ -5997,13 +5997,6 @@ "$ref": "#/components/schemas/resource-links" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -6320,6 +6313,13 @@ "$ref": "#/components/schemas/relationships-in-create-airplane-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6350,6 +6350,13 @@ "$ref": "#/components/schemas/relationships-in-create-flight-attendant-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6373,6 +6380,13 @@ "$ref": "#/components/schemas/relationships-in-create-flight-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6396,6 +6410,13 @@ "$ref": "#/components/schemas/attributes-in-create-passenger-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6409,6 +6430,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -6453,6 +6481,13 @@ "$ref": "#/components/schemas/relationships-in-update-airplane-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6487,6 +6522,13 @@ "$ref": "#/components/schemas/relationships-in-update-flight-attendant-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6521,6 +6563,13 @@ "$ref": "#/components/schemas/relationships-in-update-flight-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6548,6 +6597,13 @@ "$ref": "#/components/schemas/attributes-in-update-passenger-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6783,13 +6839,6 @@ "$ref": "#/components/schemas/resource-links" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -6850,6 +6899,13 @@ }, "id": { "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6870,6 +6926,13 @@ }, "id": { "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7141,13 +7204,6 @@ "$ref": "#/components/schemas/resource-links" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -7208,6 +7264,13 @@ }, "id": { "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7228,6 +7291,13 @@ }, "id": { "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7566,13 +7636,6 @@ "$ref": "#/components/schemas/resource-links" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -7633,6 +7696,13 @@ }, "id": { "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7653,6 +7723,13 @@ }, "id": { "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json index 49a069b0b2..0ef1436d01 100644 --- a/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json @@ -3789,13 +3789,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -3821,6 +3814,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3843,6 +3843,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4162,6 +4169,13 @@ "$ref": "#/components/schemas/attributesInCreateAccommodationRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4185,6 +4199,13 @@ "$ref": "#/components/schemas/attributesInCreateExcursionRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4208,6 +4229,13 @@ "$ref": "#/components/schemas/attributesInCreateTransportRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4238,6 +4266,13 @@ "$ref": "#/components/schemas/relationshipsInCreateVacationRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4251,6 +4286,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -4290,6 +4332,13 @@ "$ref": "#/components/schemas/attributesInUpdateAccommodationRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4319,6 +4368,13 @@ "$ref": "#/components/schemas/attributesInUpdateExcursionRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4348,6 +4404,13 @@ "$ref": "#/components/schemas/attributesInUpdateTransportRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4384,6 +4447,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateVacationRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4588,13 +4658,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -4650,6 +4713,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4672,6 +4742,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5162,13 +5239,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -5194,6 +5264,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5216,6 +5293,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5423,13 +5507,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json index 23ca988139..c6c8778a00 100644 --- a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json +++ b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json @@ -462,6 +462,13 @@ "$ref": "#/components/schemas/attributesInCreateSocialMediaAccountRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -475,6 +482,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -511,6 +525,13 @@ "$ref": "#/components/schemas/attributesInUpdateSocialMediaAccountRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -789,13 +810,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json index 5d808573a6..18845668ca 100644 --- a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json +++ b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json @@ -480,6 +480,13 @@ "$ref": "#/components/schemas/attributesInCreateSocialMediaAccountRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -493,6 +500,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -529,6 +543,13 @@ "$ref": "#/components/schemas/attributesInUpdateSocialMediaAccountRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -816,13 +837,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json index 9c2975d6f8..75194dc505 100644 --- a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json @@ -2946,6 +2946,13 @@ "$ref": "#/components/schemas/attributesInCreateStaffMemberRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -2980,6 +2987,13 @@ "$ref": "#/components/schemas/relationshipsInCreateSupermarketRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -2993,6 +3007,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -3033,6 +3054,13 @@ "$ref": "#/components/schemas/attributesInUpdateStaffMemberRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3072,6 +3100,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateSupermarketRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3779,13 +3814,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -3851,6 +3879,13 @@ "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3873,6 +3908,13 @@ "minLength": 1, "type": "string", "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4182,13 +4224,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -4217,6 +4252,13 @@ "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json index 42e364b323..2d28c0b1a8 100644 --- a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json @@ -2946,6 +2946,13 @@ "$ref": "#/components/schemas/attributes-in-create-staff-member-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -2980,6 +2987,13 @@ "$ref": "#/components/schemas/relationships-in-create-supermarket-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -2993,6 +3007,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -3033,6 +3054,13 @@ "$ref": "#/components/schemas/attributes-in-update-staff-member-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3072,6 +3100,13 @@ "$ref": "#/components/schemas/relationships-in-update-supermarket-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3779,13 +3814,6 @@ "$ref": "#/components/schemas/resource-links" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -3851,6 +3879,13 @@ "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3873,6 +3908,13 @@ "minLength": 1, "type": "string", "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4182,13 +4224,6 @@ "$ref": "#/components/schemas/resource-links" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -4217,6 +4252,13 @@ "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json index 532eded4b7..6bd3cbce1f 100644 --- a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json @@ -2946,6 +2946,13 @@ "$ref": "#/components/schemas/AttributesInCreateStaffMemberRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false @@ -2980,6 +2987,13 @@ "$ref": "#/components/schemas/RelationshipsInCreateSupermarketRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false @@ -2993,6 +3007,13 @@ "type": { "minLength": 1, "type": "string" + }, + "Meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false, @@ -3033,6 +3054,13 @@ "$ref": "#/components/schemas/AttributesInUpdateStaffMemberRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false @@ -3072,6 +3100,13 @@ "$ref": "#/components/schemas/RelationshipsInUpdateSupermarketRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false @@ -3779,13 +3814,6 @@ "$ref": "#/components/schemas/ResourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/Meta" - } - ] } }, "additionalProperties": false @@ -3851,6 +3879,13 @@ "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false @@ -3873,6 +3908,13 @@ "minLength": 1, "type": "string", "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false @@ -4182,13 +4224,6 @@ "$ref": "#/components/schemas/ResourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/Meta" - } - ] } }, "additionalProperties": false @@ -4217,6 +4252,13 @@ "lid": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json index c3825a94f3..4d330c3c02 100644 --- a/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json @@ -3255,6 +3255,13 @@ "$ref": "#/components/schemas/relationshipsInCreateNameValuePairRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3285,6 +3292,13 @@ "$ref": "#/components/schemas/relationshipsInCreateNodeRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3298,6 +3312,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -3342,6 +3363,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateNameValuePairRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3378,6 +3406,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateNodeRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3595,13 +3630,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -3657,6 +3685,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3679,6 +3714,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3824,13 +3866,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -3886,6 +3921,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3908,6 +3950,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json index ec497e92b4..eed41edf37 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json @@ -2681,6 +2681,13 @@ "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -2694,6 +2701,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -2738,6 +2752,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -2800,13 +2821,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -2862,6 +2876,13 @@ "minLength": 1, "type": "string", "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -2884,6 +2905,13 @@ "minLength": 1, "type": "string", "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3350,13 +3378,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json index 398e6b0d55..130ec0ad92 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json @@ -2676,6 +2676,13 @@ "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -2689,6 +2696,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -2733,6 +2747,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -2795,13 +2816,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -2857,6 +2871,13 @@ "minLength": 1, "type": "string", "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -2879,6 +2900,13 @@ "minLength": 1, "type": "string", "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3410,13 +3438,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json index 9812ca4d8e..7044be963a 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json @@ -3548,6 +3548,13 @@ "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3561,6 +3568,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -3605,6 +3619,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3667,13 +3688,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -3729,6 +3743,13 @@ "minLength": 1, "type": "string", "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3751,6 +3772,13 @@ "minLength": 1, "type": "string", "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4321,13 +4349,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json index 47a4022141..805dc7f838 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json @@ -3544,6 +3544,13 @@ "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3557,6 +3564,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -3601,6 +3615,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3663,13 +3684,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -3725,6 +3739,13 @@ "minLength": 1, "type": "string", "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3747,6 +3768,13 @@ "minLength": 1, "type": "string", "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4315,13 +4343,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json index 091ad52c79..090e9167b1 100644 --- a/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json @@ -4150,6 +4150,13 @@ "$ref": "#/components/schemas/relationshipsInCreateWriteOnlyChannelRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4163,6 +4170,13 @@ "type": { "minLength": 1, "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false, @@ -4209,6 +4223,13 @@ "$ref": "#/components/schemas/relationshipsInUpdateWriteOnlyChannelRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4288,13 +4309,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -4350,6 +4364,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4372,6 +4393,13 @@ "minLength": 1, "type": "string", "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4820,13 +4848,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -4988,13 +5009,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false @@ -5376,13 +5390,6 @@ "$ref": "#/components/schemas/resourceLinks" } ] - }, - "meta": { - "allOf": [ - { - "$ref": "#/components/schemas/meta" - } - ] } }, "additionalProperties": false From ddb5e10d741641013e2346e37ac88cd3a6d22aff Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Thu, 28 Nov 2024 04:17:00 +0100 Subject: [PATCH 5/9] Add missing request meta in top-level documents and relationship objects --- .../JsonApiDotNetCoreExample.json | 70 ++++++++++++ .../Models/CreatePersonRequestDocument.cs | 18 +++ .../Models/CreateTagRequestDocument.cs | 18 +++ .../Models/CreateTodoItemRequestDocument.cs | 18 +++ .../Models/NullableToOnePersonInRequest.cs | 18 +++ .../Models/ToManyTagInRequest.cs | 18 +++ .../Models/ToManyTodoItemInRequest.cs | 18 +++ .../Models/ToOnePersonInRequest.cs | 18 +++ .../Models/UpdatePersonRequestDocument.cs | 18 +++ .../Models/UpdateTagRequestDocument.cs | 18 +++ .../Models/UpdateTodoItemRequestDocument.cs | 18 +++ .../AtomicOperations/AtomicOperation.cs | 2 +- .../AtomicOperations/AtomicResult.cs | 2 +- .../CreateResourceRequestDocument.cs | 5 +- .../Documents/ErrorResponseDocument.cs | 2 +- ...lableResourceIdentifierResponseDocument.cs | 2 +- ...llableSecondaryResourceResponseDocument.cs | 2 +- .../Documents/OperationsRequestDocument.cs | 2 +- .../Documents/OperationsResponseDocument.cs | 2 +- .../PrimaryResourceResponseDocument.cs | 2 +- .../ResourceCollectionResponseDocument.cs | 2 +- ...rceIdentifierCollectionResponseDocument.cs | 2 +- .../ResourceIdentifierResponseDocument.cs | 2 +- .../SecondaryResourceResponseDocument.cs | 2 +- .../UpdateResourceRequestDocument.cs | 5 +- .../JsonApiObjects/IHasMeta.cs | 9 ++ .../JsonApiObjects/Jsonapi.cs | 2 +- .../NullableToOneRelationshipInRequest.cs | 5 +- .../NullableToOneRelationshipInResponse.cs | 2 +- .../ToManyRelationshipInRequest.cs | 5 +- .../ToManyRelationshipInResponse.cs | 2 +- .../ToOneRelationshipInRequest.cs | 5 +- .../ToOneRelationshipInResponse.cs | 2 +- .../ResourceObjects/IResourceIdentity.cs | 3 +- .../ResourceObjects/RelationshipIdentifier.cs | 2 + .../Models/CreateCourseRequestDocument.cs | 18 +++ .../Models/CreateEnrollmentRequestDocument.cs | 18 +++ .../Models/CreateStudentRequestDocument.cs | 18 +++ .../Models/CreateTeacherRequestDocument.cs | 18 +++ .../Models/NullableToOneTeacherInRequest.cs | 18 +++ .../Models/ToManyCourseInRequest.cs | 18 +++ .../Models/ToManyEnrollmentInRequest.cs | 18 +++ .../Models/ToManyStudentInRequest.cs | 18 +++ .../Models/ToManyTeacherInRequest.cs | 18 +++ .../Models/ToOneCourseInRequest.cs | 18 +++ .../Models/ToOneStudentInRequest.cs | 18 +++ .../Models/UpdateCourseRequestDocument.cs | 18 +++ .../Models/UpdateEnrollmentRequestDocument.cs | 18 +++ .../Models/UpdateStudentRequestDocument.cs | 18 +++ .../Models/UpdateTeacherRequestDocument.cs | 18 +++ .../Models/CreateGameRequestDocument.cs | 18 +++ .../CreatePlayerGroupRequestDocument.cs | 18 +++ .../Models/CreatePlayerRequestDocument.cs | 18 +++ .../Models/ToManyGameInRequest.cs | 18 +++ .../Models/ToManyPlayerGroupInRequest.cs | 18 +++ .../Models/ToManyPlayerInRequest.cs | 18 +++ .../Models/CreateCountryRequestDocument.cs | 18 +++ .../Models/ToManyLanguageInRequest.cs | 18 +++ .../Models/UpdateCountryRequestDocument.cs | 18 +++ .../CreateAccommodationRequestDocument.cs | 18 +++ .../Models/CreateExcursionRequestDocument.cs | 18 +++ .../Models/CreateTransportRequestDocument.cs | 18 +++ .../Models/CreateVacationRequestDocument.cs | 18 +++ .../Models/NullableToOneTransportInRequest.cs | 18 +++ .../Models/ToManyExcursionInRequest.cs | 18 +++ .../Models/ToOneAccommodationInRequest.cs | 18 +++ .../UpdateAccommodationRequestDocument.cs | 18 +++ .../Models/UpdateExcursionRequestDocument.cs | 18 +++ .../Models/UpdateTransportRequestDocument.cs | 18 +++ .../Models/UpdateVacationRequestDocument.cs | 18 +++ ...CreateSocialMediaAccountRequestDocument.cs | 18 +++ ...UpdateSocialMediaAccountRequestDocument.cs | 18 +++ .../CreateNameValuePairRequestDocument.cs | 18 +++ .../Models/CreateNodeRequestDocument.cs | 18 +++ .../Models/NullableToOneNodeInRequest.cs | 18 +++ .../Models/ToManyNameValuePairInRequest.cs | 18 +++ .../Models/ToManyNodeInRequest.cs | 18 +++ .../Models/ToOneNodeInRequest.cs | 18 +++ .../UpdateNameValuePairRequestDocument.cs | 18 +++ .../Models/UpdateNodeRequestDocument.cs | 18 +++ .../CreateWriteOnlyChannelRequestDocument.cs | 18 +++ .../NullableToOneDataStreamInRequest.cs | 18 +++ .../Models/ToManyDataStreamInRequest.cs | 18 +++ .../Models/ToOneDataStreamInRequest.cs | 18 +++ .../UpdateWriteOnlyChannelRequestDocument.cs | 18 +++ .../CamelCase/GeneratedTypesTests.cs | 102 ++++++++--------- .../KebabCase/GeneratedTypesTests.cs | 102 ++++++++--------- .../PascalCase/GeneratedTypesTests.cs | 102 ++++++++--------- .../GeneratedSwagger/swagger.g.json | 105 ++++++++++++++++++ .../GeneratedSwagger/swagger.g.json | 42 +++++++ .../Headers/GeneratedSwagger/swagger.g.json | 21 ++++ .../GeneratedSwagger/swagger.g.json | 91 +++++++++++++++ .../LegacyOpenApi/expected-swagger.json | 91 +++++++++++++++ .../Enabled/GeneratedSwagger/swagger.g.json | 77 +++++++++++++ .../GeneratedSwagger/net6.0/swagger.g.json | 14 +++ .../GeneratedSwagger/net8.0/swagger.g.json | 14 +++ .../CamelCase/GeneratedSwagger/swagger.g.json | 49 ++++++++ .../KebabCase/GeneratedSwagger/swagger.g.json | 49 ++++++++ .../GeneratedSwagger/swagger.g.json | 49 ++++++++ .../GeneratedSwagger/swagger.g.json | 56 ++++++++++ .../GeneratedSwagger/swagger.g.json | 28 +++++ .../GeneratedSwagger/swagger.g.json | 35 ++++++ .../GeneratedSwagger/swagger.g.json | 35 ++++++ .../GeneratedSwagger/swagger.g.json | 35 ++++++ .../GeneratedSwagger/swagger.g.json | 35 ++++++ 105 files changed, 2177 insertions(+), 176 deletions(-) create mode 100644 src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/IHasMeta.cs diff --git a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json index ec11cc5262..315699eadd 100644 --- a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json +++ b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json @@ -5303,6 +5303,13 @@ "$ref": "#/components/schemas/dataInCreatePersonRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5351,6 +5358,13 @@ "$ref": "#/components/schemas/dataInCreateTagRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5399,6 +5413,13 @@ "$ref": "#/components/schemas/dataInCreateTodoItemRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6000,6 +6021,13 @@ } ], "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7122,6 +7150,13 @@ "items": { "$ref": "#/components/schemas/tagIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7163,6 +7198,13 @@ "items": { "$ref": "#/components/schemas/todoItemIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7205,6 +7247,13 @@ "$ref": "#/components/schemas/personIdentifierInRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7766,6 +7815,13 @@ "$ref": "#/components/schemas/dataInUpdatePersonRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7821,6 +7877,13 @@ "$ref": "#/components/schemas/dataInUpdateTagRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7996,6 +8059,13 @@ "$ref": "#/components/schemas/dataInUpdateTodoItemRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreatePersonRequestDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreatePersonRequestDocument.cs index 2a716d1893..2e7e88a8ff 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreatePersonRequestDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreatePersonRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreatePersonRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreatePersonRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTagRequestDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTagRequestDocument.cs index f9c2cd9f50..d096271ea2 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTagRequestDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTagRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateTagRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTagRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTodoItemRequestDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTodoItemRequestDocument.cs index 5e4e62f7e6..47d24e1b1e 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTodoItemRequestDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTodoItemRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateTodoItemRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTodoItemRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableToOnePersonInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableToOnePersonInRequest.cs index 8c06ecf3d8..22788ae0ba 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableToOnePersonInRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableToOnePersonInRequest.cs @@ -30,6 +30,22 @@ public partial class NullableToOnePersonInRequest : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTagInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTagInRequest.cs index 8d4e22c318..8bc11cf5d7 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTagInRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTagInRequest.cs @@ -30,6 +30,22 @@ public partial class ToManyTagInRequest : IBackedModel, IParsable get { return BackingStore?.Get>("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTodoItemInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTodoItemInRequest.cs index d9d00ae426..924e335983 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTodoItemInRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTodoItemInRequest.cs @@ -30,6 +30,22 @@ public partial class ToManyTodoItemInRequest : IBackedModel, IParsable get { return BackingStore?.Get>("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToOnePersonInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToOnePersonInRequest.cs index 2b4de2d5f4..fde00a2e4a 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToOnePersonInRequest.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToOnePersonInRequest.cs @@ -30,6 +30,22 @@ public partial class ToOnePersonInRequest : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonRequestDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonRequestDocument.cs index 592ef570f7..b9ea353217 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonRequestDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdatePersonRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdatePersonRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTagRequestDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTagRequestDocument.cs index a56d50d3bf..edcfcfc048 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTagRequestDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTagRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateTagRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTagRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemRequestDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemRequestDocument.cs index bc1b6fc7bc..923fca9af5 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemRequestDocument.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateTodoItemRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTodoItemRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicOperation.cs index eb42e73a11..6f0934008d 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicOperation.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicOperation.cs @@ -4,7 +4,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal abstract class AtomicOperation +internal abstract class AtomicOperation : IHasMeta { [JsonPropertyName("meta")] public Meta Meta { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicResult.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicResult.cs index ed910369a8..9e12fca162 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicResult.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicResult.cs @@ -5,7 +5,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class AtomicResult +internal sealed class AtomicResult : IHasMeta { [JsonPropertyName("data")] public ResourceData Data { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CreateResourceRequestDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CreateResourceRequestDocument.cs index 13148eecd2..7d64cf6c96 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CreateResourceRequestDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CreateResourceRequestDocument.cs @@ -7,10 +7,13 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class CreateResourceRequestDocument +internal sealed class CreateResourceRequestDocument : IHasMeta where TResource : IIdentifiable { [Required] [JsonPropertyName("data")] public DataInCreateResourceRequest Data { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ErrorResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ErrorResponseDocument.cs index 72f042fd46..750c83ef74 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ErrorResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ErrorResponseDocument.cs @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ErrorResponseDocument +internal sealed class ErrorResponseDocument : IHasMeta { [JsonPropertyName("jsonapi")] public Jsonapi Jsonapi { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableResourceIdentifierResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableResourceIdentifierResponseDocument.cs index 5e3e60b998..9c44327b39 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableResourceIdentifierResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableResourceIdentifierResponseDocument.cs @@ -10,7 +10,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; // Types in the JsonApiObjects namespace are never touched by ASP.NET ModelState validation, therefore using a non-nullable reference type for a property does not // imply this property is required. Instead, we use [Required] explicitly, because this is how Swashbuckle is instructed to mark properties as required. [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class NullableResourceIdentifierResponseDocument +internal sealed class NullableResourceIdentifierResponseDocument : IHasMeta where TResource : IIdentifiable { [JsonPropertyName("jsonapi")] diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableSecondaryResourceResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableSecondaryResourceResponseDocument.cs index 7b82a9c528..def465b2ef 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableSecondaryResourceResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableSecondaryResourceResponseDocument.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class NullableSecondaryResourceResponseDocument +internal sealed class NullableSecondaryResourceResponseDocument : IHasMeta where TResource : IIdentifiable { [JsonPropertyName("jsonapi")] diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/OperationsRequestDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/OperationsRequestDocument.cs index dfafc6f124..6bd3a1dad2 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/OperationsRequestDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/OperationsRequestDocument.cs @@ -6,7 +6,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class OperationsRequestDocument +internal sealed class OperationsRequestDocument : IHasMeta { [Required] [MinLength(1)] diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/OperationsResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/OperationsResponseDocument.cs index c9c9b5d8aa..1c962fba84 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/OperationsResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/OperationsResponseDocument.cs @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class OperationsResponseDocument +internal sealed class OperationsResponseDocument : IHasMeta { [JsonPropertyName("jsonapi")] public Jsonapi Jsonapi { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/PrimaryResourceResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/PrimaryResourceResponseDocument.cs index ecaaa19155..876c573129 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/PrimaryResourceResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/PrimaryResourceResponseDocument.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class PrimaryResourceResponseDocument +internal sealed class PrimaryResourceResponseDocument : IHasMeta where TResource : IIdentifiable { [JsonPropertyName("jsonapi")] diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceCollectionResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceCollectionResponseDocument.cs index e9165612c4..9368e4dabe 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceCollectionResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceCollectionResponseDocument.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ResourceCollectionResponseDocument +internal sealed class ResourceCollectionResponseDocument : IHasMeta where TResource : IIdentifiable { [JsonPropertyName("jsonapi")] diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceIdentifierCollectionResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceIdentifierCollectionResponseDocument.cs index bfb73cf194..9b4affde1b 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceIdentifierCollectionResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceIdentifierCollectionResponseDocument.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ResourceIdentifierCollectionResponseDocument +internal sealed class ResourceIdentifierCollectionResponseDocument : IHasMeta where TResource : IIdentifiable { [JsonPropertyName("jsonapi")] diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceIdentifierResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceIdentifierResponseDocument.cs index b238d17359..bcefbfe107 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceIdentifierResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ResourceIdentifierResponseDocument.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ResourceIdentifierResponseDocument +internal sealed class ResourceIdentifierResponseDocument : IHasMeta where TResource : IIdentifiable { [JsonPropertyName("jsonapi")] diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/SecondaryResourceResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/SecondaryResourceResponseDocument.cs index 2c02730c2a..d0aa1c5819 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/SecondaryResourceResponseDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/SecondaryResourceResponseDocument.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class SecondaryResourceResponseDocument +internal sealed class SecondaryResourceResponseDocument : IHasMeta where TResource : IIdentifiable { [JsonPropertyName("jsonapi")] diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/UpdateResourceRequestDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/UpdateResourceRequestDocument.cs index b4bc122b04..bc5fff36db 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/UpdateResourceRequestDocument.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/UpdateResourceRequestDocument.cs @@ -7,10 +7,13 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class UpdateResourceRequestDocument +internal sealed class UpdateResourceRequestDocument : IHasMeta where TResource : IIdentifiable { [Required] [JsonPropertyName("data")] public DataInUpdateResourceRequest Data { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/IHasMeta.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/IHasMeta.cs new file mode 100644 index 0000000000..64315dee42 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/IHasMeta.cs @@ -0,0 +1,9 @@ +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal interface IHasMeta +{ + Meta Meta { get; set; } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Jsonapi.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Jsonapi.cs index b51abdf402..692b5d77ac 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Jsonapi.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Jsonapi.cs @@ -4,7 +4,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class Jsonapi +internal sealed class Jsonapi : IHasMeta { [JsonPropertyName("version")] public string Version { get; set; } = null!; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneRelationshipInRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneRelationshipInRequest.cs index 3064eda721..7a8cf67139 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneRelationshipInRequest.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneRelationshipInRequest.cs @@ -7,10 +7,13 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class NullableToOneRelationshipInRequest +internal sealed class NullableToOneRelationshipInRequest : IHasMeta where TResource : IIdentifiable { [Required] [JsonPropertyName("data")] public ResourceIdentifierInRequest? Data { get; set; } + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneRelationshipInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneRelationshipInResponse.cs index 400edf780a..3e4088762b 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneRelationshipInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneRelationshipInResponse.cs @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class NullableToOneRelationshipInResponse +internal sealed class NullableToOneRelationshipInResponse : IHasMeta where TResource : IIdentifiable { // Non-required because the related controller may be unavailable when used in an include. diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyRelationshipInRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyRelationshipInRequest.cs index c14af1ed0f..60ac184499 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyRelationshipInRequest.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyRelationshipInRequest.cs @@ -7,10 +7,13 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ToManyRelationshipInRequest +internal sealed class ToManyRelationshipInRequest : IHasMeta where TResource : IIdentifiable { [Required] [JsonPropertyName("data")] public ICollection> Data { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyRelationshipInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyRelationshipInResponse.cs index fb7ca5a751..0fa82742a4 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyRelationshipInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyRelationshipInResponse.cs @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ToManyRelationshipInResponse +internal sealed class ToManyRelationshipInResponse : IHasMeta where TResource : IIdentifiable { // Non-required because the related controller may be unavailable when used in an include. diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneRelationshipInRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneRelationshipInRequest.cs index 39efd01441..c450ba6ab9 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneRelationshipInRequest.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneRelationshipInRequest.cs @@ -7,10 +7,13 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ToOneRelationshipInRequest +internal sealed class ToOneRelationshipInRequest : IHasMeta where TResource : IIdentifiable { [Required] [JsonPropertyName("data")] public ResourceIdentifierInRequest Data { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneRelationshipInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneRelationshipInResponse.cs index 1232129942..6d31f59c57 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneRelationshipInResponse.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneRelationshipInResponse.cs @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal sealed class ToOneRelationshipInResponse +internal sealed class ToOneRelationshipInResponse : IHasMeta where TResource : IIdentifiable { // Non-required because the related controller may be unavailable when used in an include. diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IResourceIdentity.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IResourceIdentity.cs index 9528dc75f4..52985d68d9 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IResourceIdentity.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IResourceIdentity.cs @@ -3,9 +3,8 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; [UsedImplicitly(ImplicitUseTargetFlags.Members)] -internal interface IResourceIdentity +internal interface IResourceIdentity : IHasMeta { string Type { get; set; } string Id { get; set; } - Meta Meta { get; set; } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipIdentifier.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipIdentifier.cs index 6ab945938f..19dc3fad3c 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipIdentifier.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipIdentifier.cs @@ -12,4 +12,6 @@ internal sealed class RelationshipIdentifier : ResourceIdentifierInRe [Required] [JsonPropertyName("relationship")] public string Relationship { get; set; } = null!; + + // Meta is erased at runtime. } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateCourseRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateCourseRequestDocument.cs index 686b66f025..64df9c3fef 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateCourseRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateCourseRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateCourseRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateCourseRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateEnrollmentRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateEnrollmentRequestDocument.cs index d9b62d31c5..5aee9b7254 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateEnrollmentRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateEnrollmentRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateEnrollmentRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateEnrollmentRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateStudentRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateStudentRequestDocument.cs index a588d48874..d4cd43578f 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateStudentRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateStudentRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateStudentRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateStudentRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateTeacherRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateTeacherRequestDocument.cs index 8253885436..8ff49fd383 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateTeacherRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateTeacherRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateTeacherRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateTeacherRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/NullableToOneTeacherInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/NullableToOneTeacherInRequest.cs index bf84e96506..7754851505 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/NullableToOneTeacherInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/NullableToOneTeacherInRequest.cs @@ -30,6 +30,22 @@ public partial class NullableToOneTeacherInRequest : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyCourseInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyCourseInRequest.cs index c8089eea9c..978c13106b 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyCourseInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyCourseInRequest.cs @@ -30,6 +30,22 @@ public partial class ToManyCourseInRequest : IBackedModel, IParsable get { return BackingStore?.Get>("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyEnrollmentInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyEnrollmentInRequest.cs index d8406b94bd..86df45053a 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyEnrollmentInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyEnrollmentInRequest.cs @@ -30,6 +30,22 @@ public partial class ToManyEnrollmentInRequest : IBackedModel, IParsable get { return BackingStore?.Get>("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyStudentInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyStudentInRequest.cs index 3dbaef4b58..39bd3c2896 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyStudentInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyStudentInRequest.cs @@ -30,6 +30,22 @@ public partial class ToManyStudentInRequest : IBackedModel, IParsable get { return BackingStore?.Get>("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyTeacherInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyTeacherInRequest.cs index d02e99a9d3..13837a8f5f 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyTeacherInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyTeacherInRequest.cs @@ -30,6 +30,22 @@ public partial class ToManyTeacherInRequest : IBackedModel, IParsable get { return BackingStore?.Get>("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneCourseInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneCourseInRequest.cs index afccaad76e..7c51be1567 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneCourseInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneCourseInRequest.cs @@ -30,6 +30,22 @@ public partial class ToOneCourseInRequest : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneStudentInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneStudentInRequest.cs index 3874e32c92..5ba519554d 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneStudentInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneStudentInRequest.cs @@ -30,6 +30,22 @@ public partial class ToOneStudentInRequest : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateCourseRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateCourseRequestDocument.cs index 96b1e21b52..8bf1fdd246 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateCourseRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateCourseRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateCourseRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateCourseRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateEnrollmentRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateEnrollmentRequestDocument.cs index ccd765f105..705a6b25c0 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateEnrollmentRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateEnrollmentRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateEnrollmentRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateEnrollmentRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateStudentRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateStudentRequestDocument.cs index d20ceb652b..2df66ee389 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateStudentRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateStudentRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateStudentRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateStudentRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateTeacherRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateTeacherRequestDocument.cs index 92dd46d537..7afbea8258 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateTeacherRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateTeacherRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateTeacherRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateTeacherRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreateGameRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreateGameRequestDocument.cs index 068bc45376..c7cc3d0b71 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreateGameRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreateGameRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateGameRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreateGameRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreatePlayerGroupRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreatePlayerGroupRequestDocument.cs index dfbe1fdc7e..20f2917fdd 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreatePlayerGroupRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreatePlayerGroupRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreatePlayerGroupRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerGroupRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreatePlayerRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreatePlayerRequestDocument.cs index f4e23b74a2..879df354db 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreatePlayerRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreatePlayerRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreatePlayerRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyGameInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyGameInRequest.cs index 856fc4c087..5ab6c5c963 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyGameInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyGameInRequest.cs @@ -30,6 +30,22 @@ public partial class ToManyGameInRequest : IBackedModel, IParsable get { return BackingStore?.Get>("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerGroupInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerGroupInRequest.cs index 5e22b1ce2d..4ad2714ed7 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerGroupInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerGroupInRequest.cs @@ -30,6 +30,22 @@ public partial class ToManyPlayerGroupInRequest : IBackedModel, IParsable get { return BackingStore?.Get>("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerInRequest.cs index 15ae85fa4b..642eb284c9 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerInRequest.cs @@ -30,6 +30,22 @@ public partial class ToManyPlayerInRequest : IBackedModel, IParsable get { return BackingStore?.Get>("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CreateCountryRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CreateCountryRequestDocument.cs index 083a04d54c..a02ff478aa 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CreateCountryRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CreateCountryRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateCountryRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCreateCountryRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ToManyLanguageInRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ToManyLanguageInRequest.cs index cfacd59039..b082459efe 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ToManyLanguageInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ToManyLanguageInRequest.cs @@ -30,6 +30,22 @@ public partial class ToManyLanguageInRequest : IBackedModel, IParsable get { return BackingStore?.Get>("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/UpdateCountryRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/UpdateCountryRequestDocument.cs index c3b41f2e8b..f2409ce1e1 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/UpdateCountryRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/UpdateCountryRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateCountryRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInUpdateCountryRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateAccommodationRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateAccommodationRequestDocument.cs index 936947e80b..610251c1f2 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateAccommodationRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateAccommodationRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateAccommodationRequestDocument : IBackedModel, IParsabl get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateAccommodationRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateExcursionRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateExcursionRequestDocument.cs index 148f5ab100..80901fcc34 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateExcursionRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateExcursionRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateExcursionRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateExcursionRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateTransportRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateTransportRequestDocument.cs index 2798886d97..8c2ec168f8 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateTransportRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateTransportRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateTransportRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateTransportRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateVacationRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateVacationRequestDocument.cs index 86aa3770f8..d3a051f6e7 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateVacationRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateVacationRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateVacationRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateVacationRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInRequest.cs index 281236d5f1..b5b15051dc 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInRequest.cs @@ -30,6 +30,22 @@ public partial class NullableToOneTransportInRequest : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInRequest.cs index a51d915462..c56b7f5124 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInRequest.cs @@ -30,6 +30,22 @@ public partial class ToManyExcursionInRequest : IBackedModel, IParsable get { return BackingStore?.Get>("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInRequest.cs index f8591b0f13..e71f5b454c 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInRequest.cs @@ -30,6 +30,22 @@ public partial class ToOneAccommodationInRequest : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateAccommodationRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateAccommodationRequestDocument.cs index b3a13fa2a9..7e0be17095 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateAccommodationRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateAccommodationRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateAccommodationRequestDocument : IBackedModel, IParsabl get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateAccommodationRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateExcursionRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateExcursionRequestDocument.cs index 8641a6f251..4d453fe8c6 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateExcursionRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateExcursionRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateExcursionRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateExcursionRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateTransportRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateTransportRequestDocument.cs index c7e0da1748..f9f151248b 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateTransportRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateTransportRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateTransportRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateTransportRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateVacationRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateVacationRequestDocument.cs index cf296434a1..93519c7a72 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateVacationRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateVacationRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateVacationRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateVacationRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/CreateSocialMediaAccountRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/CreateSocialMediaAccountRequestDocument.cs index a40ebf4adb..3fa88972fd 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/CreateSocialMediaAccountRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/CreateSocialMediaAccountRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateSocialMediaAccountRequestDocument : IBackedModel, IPa get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInCreateSocialMediaAccountRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/UpdateSocialMediaAccountRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/UpdateSocialMediaAccountRequestDocument.cs index b8b1e660c3..e0263ba34b 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/UpdateSocialMediaAccountRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/UpdateSocialMediaAccountRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateSocialMediaAccountRequestDocument : IBackedModel, IPa get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInUpdateSocialMediaAccountRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/CreateNameValuePairRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/CreateNameValuePairRequestDocument.cs index dc9e8d4d9d..4d1a3d5012 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/CreateNameValuePairRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/CreateNameValuePairRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateNameValuePairRequestDocument : IBackedModel, IParsabl get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNameValuePairRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/CreateNodeRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/CreateNodeRequestDocument.cs index 879fa7ab4d..8d55585cd2 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/CreateNodeRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/CreateNodeRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateNodeRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNodeRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableToOneNodeInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableToOneNodeInRequest.cs index 65210bbe31..659f356dce 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableToOneNodeInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableToOneNodeInRequest.cs @@ -30,6 +30,22 @@ public partial class NullableToOneNodeInRequest : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNameValuePairInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNameValuePairInRequest.cs index 1125beb4ae..591df4508f 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNameValuePairInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNameValuePairInRequest.cs @@ -30,6 +30,22 @@ public partial class ToManyNameValuePairInRequest : IBackedModel, IParsable get { return BackingStore?.Get>("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNodeInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNodeInRequest.cs index 9c01b8b823..4ff84236ed 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNodeInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNodeInRequest.cs @@ -30,6 +30,22 @@ public partial class ToManyNodeInRequest : IBackedModel, IParsable get { return BackingStore?.Get>("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToOneNodeInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToOneNodeInRequest.cs index f523926344..b33cddbb0c 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToOneNodeInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToOneNodeInRequest.cs @@ -30,6 +30,22 @@ public partial class ToOneNodeInRequest : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/UpdateNameValuePairRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/UpdateNameValuePairRequestDocument.cs index 4821fd5dc5..ec979206b6 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/UpdateNameValuePairRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/UpdateNameValuePairRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateNameValuePairRequestDocument : IBackedModel, IParsabl get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNameValuePairRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/UpdateNodeRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/UpdateNodeRequestDocument.cs index 83730ee3c5..32d3395929 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/UpdateNodeRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/UpdateNodeRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateNodeRequestDocument : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNodeRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/CreateWriteOnlyChannelRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/CreateWriteOnlyChannelRequestDocument.cs index c4dcccbe74..4639bff460 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/CreateWriteOnlyChannelRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/CreateWriteOnlyChannelRequestDocument.cs @@ -30,6 +30,22 @@ public partial class CreateWriteOnlyChannelRequestDocument : IBackedModel, IPars get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInCreateWriteOnlyChannelRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableToOneDataStreamInRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableToOneDataStreamInRequest.cs index 501059cbdf..52238b60a1 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableToOneDataStreamInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableToOneDataStreamInRequest.cs @@ -30,6 +30,22 @@ public partial class NullableToOneDataStreamInRequest : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToManyDataStreamInRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToManyDataStreamInRequest.cs index a2249c8171..3760a50be8 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToManyDataStreamInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToManyDataStreamInRequest.cs @@ -30,6 +30,22 @@ public partial class ToManyDataStreamInRequest : IBackedModel, IParsable get { return BackingStore?.Get>("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToOneDataStreamInRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToOneDataStreamInRequest.cs index e1513be491..237f684aae 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToOneDataStreamInRequest.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToOneDataStreamInRequest.cs @@ -30,6 +30,22 @@ public partial class ToOneDataStreamInRequest : IBackedModel, IParsable get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/UpdateWriteOnlyChannelRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/UpdateWriteOnlyChannelRequestDocument.cs index 2c096445c6..5690e4967e 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/UpdateWriteOnlyChannelRequestDocument.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/UpdateWriteOnlyChannelRequestDocument.cs @@ -30,6 +30,22 @@ public partial class UpdateWriteOnlyChannelRequestDocument : IBackedModel, IPars get { return BackingStore?.Get("data"); } set { BackingStore?.Set("data", value); } } +#endif + /// The meta property +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } +#nullable restore +#else + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } #endif /// /// Instantiates a new and sets the default values. @@ -57,6 +73,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInUpdateWriteOnlyChannelRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, }; } /// @@ -67,6 +84,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); } } } diff --git a/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs index efd34ab622..196c22f6b7 100644 --- a/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs +++ b/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs @@ -48,25 +48,25 @@ public void Generated_endpoint_methods_are_named_as_expected() [Fact] public void Generated_top_level_document_types_are_named_as_expected() { - _ = nameof(SupermarketCollectionResponseDocument); - _ = nameof(CreateSupermarketRequestDocument); - _ = nameof(SupermarketPrimaryResponseDocument); - _ = nameof(UpdateSupermarketRequestDocument); - - _ = nameof(StaffMemberCollectionResponseDocument); - _ = nameof(CreateStaffMemberRequestDocument); - _ = nameof(StaffMemberPrimaryResponseDocument); - _ = nameof(UpdateStaffMemberRequestDocument); - _ = nameof(StaffMemberIdentifierCollectionResponseDocument); - _ = nameof(StaffMemberIdentifierResponseDocument); - _ = nameof(StaffMemberSecondaryResponseDocument); - _ = nameof(NullableStaffMemberSecondaryResponseDocument); - _ = nameof(NullableStaffMemberIdentifierResponseDocument); - - _ = nameof(ErrorResponseDocument); - - _ = nameof(OperationsRequestDocument); - _ = nameof(OperationsResponseDocument); + _ = nameof(SupermarketCollectionResponseDocument.Meta); + _ = nameof(CreateSupermarketRequestDocument.Meta); + _ = nameof(SupermarketPrimaryResponseDocument.Meta); + _ = nameof(UpdateSupermarketRequestDocument.Meta); + + _ = nameof(StaffMemberCollectionResponseDocument.Meta); + _ = nameof(CreateStaffMemberRequestDocument.Meta); + _ = nameof(StaffMemberPrimaryResponseDocument.Meta); + _ = nameof(UpdateStaffMemberRequestDocument.Meta); + _ = nameof(StaffMemberIdentifierCollectionResponseDocument.Meta); + _ = nameof(StaffMemberIdentifierResponseDocument.Meta); + _ = nameof(StaffMemberSecondaryResponseDocument.Meta); + _ = nameof(NullableStaffMemberSecondaryResponseDocument.Meta); + _ = nameof(NullableStaffMemberIdentifierResponseDocument.Meta); + + _ = nameof(ErrorResponseDocument.Meta); + + _ = nameof(OperationsRequestDocument.Meta); + _ = nameof(OperationsResponseDocument.Meta); } [Fact] @@ -85,18 +85,18 @@ public void Generated_link_types_are_named_as_expected() [Fact] public void Generated_operation_types_are_named_as_expected() { - _ = nameof(CreateSupermarketOperation); - _ = nameof(UpdateSupermarketOperation); - _ = nameof(DeleteSupermarketOperation); - _ = nameof(UpdateSupermarketBackupStoreManagerRelationshipOperation); - _ = nameof(UpdateSupermarketCashiersRelationshipOperation); - _ = nameof(AddToSupermarketCashiersRelationshipOperation); - _ = nameof(RemoveFromSupermarketCashiersRelationshipOperation); - _ = nameof(UpdateSupermarketStoreManagerRelationshipOperation); - - _ = nameof(CreateStaffMemberOperation); - _ = nameof(UpdateStaffMemberOperation); - _ = nameof(DeleteStaffMemberOperation); + _ = nameof(CreateSupermarketOperation.Meta); + _ = nameof(UpdateSupermarketOperation.Meta); + _ = nameof(DeleteSupermarketOperation.Meta); + _ = nameof(UpdateSupermarketBackupStoreManagerRelationshipOperation.Meta); + _ = nameof(UpdateSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(AddToSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(RemoveFromSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(UpdateSupermarketStoreManagerRelationshipOperation.Meta); + + _ = nameof(CreateStaffMemberOperation.Meta); + _ = nameof(UpdateStaffMemberOperation.Meta); + _ = nameof(DeleteStaffMemberOperation.Meta); } [Fact] @@ -130,12 +130,12 @@ public void Generated_resource_field_types_are_named_as_expected() [Fact] public void Generated_relationship_container_types_are_named_as_expected() { - _ = nameof(ToOneStaffMemberInRequest); - _ = nameof(ToOneStaffMemberInResponse); - _ = nameof(NullableToOneStaffMemberInRequest); - _ = nameof(NullableToOneStaffMemberInResponse); - _ = nameof(ToManyStaffMemberInRequest); - _ = nameof(ToManyStaffMemberInResponse); + _ = nameof(ToOneStaffMemberInRequest.Meta); + _ = nameof(ToOneStaffMemberInResponse.Meta); + _ = nameof(NullableToOneStaffMemberInRequest.Meta); + _ = nameof(NullableToOneStaffMemberInResponse.Meta); + _ = nameof(ToManyStaffMemberInRequest.Meta); + _ = nameof(ToManyStaffMemberInResponse.Meta); _ = nameof(SupermarketBackupStoreManagerRelationshipIdentifier); _ = nameof(SupermarketCashiersRelationshipIdentifier); @@ -168,31 +168,31 @@ public void Generated_operation_type_enums_are_named_as_expected() [Fact] public void Generated_data_types_are_named_as_expected() { - _ = nameof(DataInResponse); + _ = nameof(DataInResponse.Meta); - _ = nameof(DataInCreateSupermarketRequest); - _ = nameof(DataInUpdateSupermarketRequest); - _ = nameof(SupermarketDataInResponse); + _ = nameof(DataInCreateSupermarketRequest.Meta); + _ = nameof(DataInUpdateSupermarketRequest.Meta); + _ = nameof(SupermarketDataInResponse.Meta); - _ = nameof(SupermarketIdentifierInRequest); + _ = nameof(SupermarketIdentifierInRequest.Meta); - _ = nameof(DataInCreateStaffMemberRequest); - _ = nameof(DataInUpdateStaffMemberRequest); - _ = nameof(StaffMemberDataInResponse); + _ = nameof(DataInCreateStaffMemberRequest.Meta); + _ = nameof(DataInUpdateStaffMemberRequest.Meta); + _ = nameof(StaffMemberDataInResponse.Meta); - _ = nameof(StaffMemberIdentifierInRequest); - _ = nameof(StaffMemberIdentifierInResponse); + _ = nameof(StaffMemberIdentifierInRequest.Meta); + _ = nameof(StaffMemberIdentifierInResponse.Meta); } [Fact] public void Generated_predefined_types_are_named_as_expected() { - _ = nameof(Jsonapi); - _ = nameof(ErrorObject); + _ = nameof(Jsonapi.Meta); + _ = nameof(ErrorObject.Meta); _ = nameof(ErrorSource); _ = nameof(Meta); - _ = nameof(AtomicOperation); - _ = nameof(AtomicResult); + _ = nameof(AtomicOperation.Meta); + _ = nameof(AtomicResult.Meta); } } diff --git a/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs index 85ff237b20..dbfdefa39d 100644 --- a/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs +++ b/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs @@ -48,25 +48,25 @@ public void Generated_endpoint_methods_are_named_as_expected() [Fact] public void Generated_top_level_document_types_are_named_as_expected() { - _ = nameof(SupermarketCollectionResponseDocument); - _ = nameof(CreateSupermarketRequestDocument); - _ = nameof(SupermarketPrimaryResponseDocument); - _ = nameof(UpdateSupermarketRequestDocument); - - _ = nameof(StaffMemberCollectionResponseDocument); - _ = nameof(CreateStaffMemberRequestDocument); - _ = nameof(StaffMemberPrimaryResponseDocument); - _ = nameof(UpdateStaffMemberRequestDocument); - _ = nameof(StaffMemberIdentifierCollectionResponseDocument); - _ = nameof(StaffMemberIdentifierResponseDocument); - _ = nameof(StaffMemberSecondaryResponseDocument); - _ = nameof(NullableStaffMemberSecondaryResponseDocument); - _ = nameof(NullableStaffMemberIdentifierResponseDocument); - - _ = nameof(ErrorResponseDocument); - - _ = nameof(OperationsRequestDocument); - _ = nameof(OperationsResponseDocument); + _ = nameof(SupermarketCollectionResponseDocument.Meta); + _ = nameof(CreateSupermarketRequestDocument.Meta); + _ = nameof(SupermarketPrimaryResponseDocument.Meta); + _ = nameof(UpdateSupermarketRequestDocument.Meta); + + _ = nameof(StaffMemberCollectionResponseDocument.Meta); + _ = nameof(CreateStaffMemberRequestDocument.Meta); + _ = nameof(StaffMemberPrimaryResponseDocument.Meta); + _ = nameof(UpdateStaffMemberRequestDocument.Meta); + _ = nameof(StaffMemberIdentifierCollectionResponseDocument.Meta); + _ = nameof(StaffMemberIdentifierResponseDocument.Meta); + _ = nameof(StaffMemberSecondaryResponseDocument.Meta); + _ = nameof(NullableStaffMemberSecondaryResponseDocument.Meta); + _ = nameof(NullableStaffMemberIdentifierResponseDocument.Meta); + + _ = nameof(ErrorResponseDocument.Meta); + + _ = nameof(OperationsRequestDocument.Meta); + _ = nameof(OperationsResponseDocument.Meta); } [Fact] @@ -85,18 +85,18 @@ public void Generated_link_types_are_named_as_expected() [Fact] public void Generated_operation_types_are_named_as_expected() { - _ = nameof(CreateSupermarketOperation); - _ = nameof(UpdateSupermarketOperation); - _ = nameof(DeleteSupermarketOperation); - _ = nameof(UpdateSupermarketBackupStoreManagerRelationshipOperation); - _ = nameof(UpdateSupermarketCashiersRelationshipOperation); - _ = nameof(AddToSupermarketCashiersRelationshipOperation); - _ = nameof(RemoveFromSupermarketCashiersRelationshipOperation); - _ = nameof(UpdateSupermarketStoreManagerRelationshipOperation); - - _ = nameof(CreateStaffMemberOperation); - _ = nameof(UpdateStaffMemberOperation); - _ = nameof(DeleteStaffMemberOperation); + _ = nameof(CreateSupermarketOperation.Meta); + _ = nameof(UpdateSupermarketOperation.Meta); + _ = nameof(DeleteSupermarketOperation.Meta); + _ = nameof(UpdateSupermarketBackupStoreManagerRelationshipOperation.Meta); + _ = nameof(UpdateSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(AddToSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(RemoveFromSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(UpdateSupermarketStoreManagerRelationshipOperation.Meta); + + _ = nameof(CreateStaffMemberOperation.Meta); + _ = nameof(UpdateStaffMemberOperation.Meta); + _ = nameof(DeleteStaffMemberOperation.Meta); } [Fact] @@ -130,12 +130,12 @@ public void Generated_resource_field_types_are_named_as_expected() [Fact] public void Generated_relationship_container_types_are_named_as_expected() { - _ = nameof(ToOneStaffMemberInRequest); - _ = nameof(ToOneStaffMemberInResponse); - _ = nameof(NullableToOneStaffMemberInRequest); - _ = nameof(NullableToOneStaffMemberInResponse); - _ = nameof(ToManyStaffMemberInRequest); - _ = nameof(ToManyStaffMemberInResponse); + _ = nameof(ToOneStaffMemberInRequest.Meta); + _ = nameof(ToOneStaffMemberInResponse.Meta); + _ = nameof(NullableToOneStaffMemberInRequest.Meta); + _ = nameof(NullableToOneStaffMemberInResponse.Meta); + _ = nameof(ToManyStaffMemberInRequest.Meta); + _ = nameof(ToManyStaffMemberInResponse.Meta); _ = nameof(SupermarketBackupStoreManagerRelationshipIdentifier); _ = nameof(SupermarketCashiersRelationshipIdentifier); @@ -168,31 +168,31 @@ public void Generated_operation_type_enums_are_named_as_expected() [Fact] public void Generated_data_types_are_named_as_expected() { - _ = nameof(DataInResponse); + _ = nameof(DataInResponse.Meta); - _ = nameof(DataInCreateSupermarketRequest); - _ = nameof(DataInUpdateSupermarketRequest); - _ = nameof(SupermarketDataInResponse); + _ = nameof(DataInCreateSupermarketRequest.Meta); + _ = nameof(DataInUpdateSupermarketRequest.Meta); + _ = nameof(SupermarketDataInResponse.Meta); - _ = nameof(SupermarketIdentifierInRequest); + _ = nameof(SupermarketIdentifierInRequest.Meta); - _ = nameof(DataInCreateStaffMemberRequest); - _ = nameof(DataInUpdateStaffMemberRequest); - _ = nameof(StaffMemberDataInResponse); + _ = nameof(DataInCreateStaffMemberRequest.Meta); + _ = nameof(DataInUpdateStaffMemberRequest.Meta); + _ = nameof(StaffMemberDataInResponse.Meta); - _ = nameof(StaffMemberIdentifierInRequest); - _ = nameof(StaffMemberIdentifierInResponse); + _ = nameof(StaffMemberIdentifierInRequest.Meta); + _ = nameof(StaffMemberIdentifierInResponse.Meta); } [Fact] public void Generated_predefined_types_are_named_as_expected() { - _ = nameof(Jsonapi); - _ = nameof(ErrorObject); + _ = nameof(Jsonapi.Meta); + _ = nameof(ErrorObject.Meta); _ = nameof(ErrorSource); _ = nameof(Meta); - _ = nameof(AtomicOperation); - _ = nameof(AtomicResult); + _ = nameof(AtomicOperation.Meta); + _ = nameof(AtomicResult.Meta); } } diff --git a/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs index ae222b410a..85aec10a24 100644 --- a/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs +++ b/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs @@ -48,25 +48,25 @@ public void Generated_endpoint_methods_are_named_as_expected() [Fact] public void Generated_top_level_document_types_are_named_as_expected() { - _ = nameof(SupermarketCollectionResponseDocument); - _ = nameof(CreateSupermarketRequestDocument); - _ = nameof(SupermarketPrimaryResponseDocument); - _ = nameof(UpdateSupermarketRequestDocument); - - _ = nameof(StaffMemberCollectionResponseDocument); - _ = nameof(CreateStaffMemberRequestDocument); - _ = nameof(StaffMemberPrimaryResponseDocument); - _ = nameof(UpdateStaffMemberRequestDocument); - _ = nameof(StaffMemberIdentifierCollectionResponseDocument); - _ = nameof(StaffMemberIdentifierResponseDocument); - _ = nameof(StaffMemberSecondaryResponseDocument); - _ = nameof(NullableStaffMemberSecondaryResponseDocument); - _ = nameof(NullableStaffMemberIdentifierResponseDocument); - - _ = nameof(ErrorResponseDocument); - - _ = nameof(OperationsRequestDocument); - _ = nameof(OperationsResponseDocument); + _ = nameof(SupermarketCollectionResponseDocument.Meta); + _ = nameof(CreateSupermarketRequestDocument.Meta); + _ = nameof(SupermarketPrimaryResponseDocument.Meta); + _ = nameof(UpdateSupermarketRequestDocument.Meta); + + _ = nameof(StaffMemberCollectionResponseDocument.Meta); + _ = nameof(CreateStaffMemberRequestDocument.Meta); + _ = nameof(StaffMemberPrimaryResponseDocument.Meta); + _ = nameof(UpdateStaffMemberRequestDocument.Meta); + _ = nameof(StaffMemberIdentifierCollectionResponseDocument.Meta); + _ = nameof(StaffMemberIdentifierResponseDocument.Meta); + _ = nameof(StaffMemberSecondaryResponseDocument.Meta); + _ = nameof(NullableStaffMemberSecondaryResponseDocument.Meta); + _ = nameof(NullableStaffMemberIdentifierResponseDocument.Meta); + + _ = nameof(ErrorResponseDocument.Meta); + + _ = nameof(OperationsRequestDocument.Meta); + _ = nameof(OperationsResponseDocument.Meta); } [Fact] @@ -85,18 +85,18 @@ public void Generated_link_types_are_named_as_expected() [Fact] public void Generated_operation_types_are_named_as_expected() { - _ = nameof(CreateSupermarketOperation); - _ = nameof(UpdateSupermarketOperation); - _ = nameof(DeleteSupermarketOperation); - _ = nameof(UpdateSupermarketBackupStoreManagerRelationshipOperation); - _ = nameof(UpdateSupermarketCashiersRelationshipOperation); - _ = nameof(AddToSupermarketCashiersRelationshipOperation); - _ = nameof(RemoveFromSupermarketCashiersRelationshipOperation); - _ = nameof(UpdateSupermarketStoreManagerRelationshipOperation); - - _ = nameof(CreateStaffMemberOperation); - _ = nameof(UpdateStaffMemberOperation); - _ = nameof(DeleteStaffMemberOperation); + _ = nameof(CreateSupermarketOperation.Meta); + _ = nameof(UpdateSupermarketOperation.Meta); + _ = nameof(DeleteSupermarketOperation.Meta); + _ = nameof(UpdateSupermarketBackupStoreManagerRelationshipOperation.Meta); + _ = nameof(UpdateSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(AddToSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(RemoveFromSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(UpdateSupermarketStoreManagerRelationshipOperation.Meta); + + _ = nameof(CreateStaffMemberOperation.Meta); + _ = nameof(UpdateStaffMemberOperation.Meta); + _ = nameof(DeleteStaffMemberOperation.Meta); } [Fact] @@ -130,12 +130,12 @@ public void Generated_resource_field_types_are_named_as_expected() [Fact] public void Generated_relationship_container_types_are_named_as_expected() { - _ = nameof(ToOneStaffMemberInRequest); - _ = nameof(ToOneStaffMemberInResponse); - _ = nameof(NullableToOneStaffMemberInRequest); - _ = nameof(NullableToOneStaffMemberInResponse); - _ = nameof(ToManyStaffMemberInRequest); - _ = nameof(ToManyStaffMemberInResponse); + _ = nameof(ToOneStaffMemberInRequest.Meta); + _ = nameof(ToOneStaffMemberInResponse.Meta); + _ = nameof(NullableToOneStaffMemberInRequest.Meta); + _ = nameof(NullableToOneStaffMemberInResponse.Meta); + _ = nameof(ToManyStaffMemberInRequest.Meta); + _ = nameof(ToManyStaffMemberInResponse.Meta); _ = nameof(SupermarketBackupStoreManagerRelationshipIdentifier); _ = nameof(SupermarketCashiersRelationshipIdentifier); @@ -168,31 +168,31 @@ public void Generated_operation_type_enums_are_named_as_expected() [Fact] public void Generated_data_types_are_named_as_expected() { - _ = nameof(DataInResponse); + _ = nameof(DataInResponse.Meta); - _ = nameof(DataInCreateSupermarketRequest); - _ = nameof(DataInUpdateSupermarketRequest); - _ = nameof(SupermarketDataInResponse); + _ = nameof(DataInCreateSupermarketRequest.Meta); + _ = nameof(DataInUpdateSupermarketRequest.Meta); + _ = nameof(SupermarketDataInResponse.Meta); - _ = nameof(SupermarketIdentifierInRequest); + _ = nameof(SupermarketIdentifierInRequest.Meta); - _ = nameof(DataInCreateStaffMemberRequest); - _ = nameof(DataInUpdateStaffMemberRequest); - _ = nameof(StaffMemberDataInResponse); + _ = nameof(DataInCreateStaffMemberRequest.Meta); + _ = nameof(DataInUpdateStaffMemberRequest.Meta); + _ = nameof(StaffMemberDataInResponse.Meta); - _ = nameof(StaffMemberIdentifierInRequest); - _ = nameof(StaffMemberIdentifierInResponse); + _ = nameof(StaffMemberIdentifierInRequest.Meta); + _ = nameof(StaffMemberIdentifierInResponse.Meta); } [Fact] public void Generated_predefined_types_are_named_as_expected() { - _ = nameof(Jsonapi); - _ = nameof(ErrorObject); + _ = nameof(Jsonapi.Meta); + _ = nameof(ErrorObject.Meta); _ = nameof(ErrorSource); _ = nameof(Meta); - _ = nameof(AtomicOperation); - _ = nameof(AtomicResult); + _ = nameof(AtomicOperation.Meta); + _ = nameof(AtomicResult.Meta); } } diff --git a/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json index 51f41a2f7a..df83a02810 100644 --- a/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json @@ -7169,6 +7169,13 @@ "$ref": "#/components/schemas/dataInCreateCourseRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7217,6 +7224,13 @@ "$ref": "#/components/schemas/dataInCreateEnrollmentRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7265,6 +7279,13 @@ "$ref": "#/components/schemas/dataInCreateStudentRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7313,6 +7334,13 @@ "$ref": "#/components/schemas/dataInCreateTeacherRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8404,6 +8432,13 @@ } ], "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -9666,6 +9701,13 @@ "items": { "$ref": "#/components/schemas/courseIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -9707,6 +9749,13 @@ "items": { "$ref": "#/components/schemas/enrollmentIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -9748,6 +9797,13 @@ "items": { "$ref": "#/components/schemas/studentIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -9789,6 +9845,13 @@ "items": { "$ref": "#/components/schemas/teacherIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -9831,6 +9894,13 @@ "$ref": "#/components/schemas/courseIdentifierInRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -9874,6 +9944,13 @@ "$ref": "#/components/schemas/studentIdentifierInRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -9995,6 +10072,13 @@ "$ref": "#/components/schemas/dataInUpdateCourseRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -10090,6 +10174,13 @@ "$ref": "#/components/schemas/dataInUpdateEnrollmentRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -10271,6 +10362,13 @@ "$ref": "#/components/schemas/dataInUpdateStudentRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -10365,6 +10463,13 @@ "$ref": "#/components/schemas/dataInUpdateTeacherRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json index f84604871d..5812f34dbc 100644 --- a/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json @@ -387,6 +387,13 @@ "$ref": "#/components/schemas/dataInCreateGameRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -403,6 +410,13 @@ "$ref": "#/components/schemas/dataInCreatePlayerGroupRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -419,6 +433,13 @@ "$ref": "#/components/schemas/dataInCreatePlayerRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1261,6 +1282,13 @@ "items": { "$ref": "#/components/schemas/gameIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1302,6 +1330,13 @@ "items": { "$ref": "#/components/schemas/playerGroupIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1343,6 +1378,13 @@ "items": { "$ref": "#/components/schemas/playerIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json index 78c3b8136b..e1f7f77a46 100644 --- a/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json @@ -1339,6 +1339,13 @@ "$ref": "#/components/schemas/dataInCreateCountryRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1878,6 +1885,13 @@ "items": { "$ref": "#/components/schemas/languageIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -1920,6 +1934,13 @@ "$ref": "#/components/schemas/dataInUpdateCountryRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json index 3f060da59f..98ff878ac9 100644 --- a/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json @@ -6235,6 +6235,13 @@ "$ref": "#/components/schemas/data-in-create-airplane-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6251,6 +6258,13 @@ "$ref": "#/components/schemas/data-in-create-flight-attendant-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6267,6 +6281,13 @@ "$ref": "#/components/schemas/data-in-create-flight-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6283,6 +6304,13 @@ "$ref": "#/components/schemas/data-in-create-passenger-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7517,6 +7545,13 @@ } ], "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8031,6 +8066,13 @@ "items": { "$ref": "#/components/schemas/flight-attendant-identifier-in-request" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8072,6 +8114,13 @@ "items": { "$ref": "#/components/schemas/flight-identifier-in-request" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8113,6 +8162,13 @@ "items": { "$ref": "#/components/schemas/passenger-identifier-in-request" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8155,6 +8211,13 @@ "$ref": "#/components/schemas/flight-attendant-identifier-in-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8198,6 +8261,13 @@ "$ref": "#/components/schemas/data-in-update-airplane-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8214,6 +8284,13 @@ "$ref": "#/components/schemas/data-in-update-flight-attendant-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8230,6 +8307,13 @@ "$ref": "#/components/schemas/data-in-update-flight-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8246,6 +8330,13 @@ "$ref": "#/components/schemas/data-in-update-passenger-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/LegacyOpenApi/expected-swagger.json b/test/OpenApiTests/LegacyOpenApi/expected-swagger.json index 3f060da59f..98ff878ac9 100644 --- a/test/OpenApiTests/LegacyOpenApi/expected-swagger.json +++ b/test/OpenApiTests/LegacyOpenApi/expected-swagger.json @@ -6235,6 +6235,13 @@ "$ref": "#/components/schemas/data-in-create-airplane-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6251,6 +6258,13 @@ "$ref": "#/components/schemas/data-in-create-flight-attendant-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6267,6 +6281,13 @@ "$ref": "#/components/schemas/data-in-create-flight-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -6283,6 +6304,13 @@ "$ref": "#/components/schemas/data-in-create-passenger-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -7517,6 +7545,13 @@ } ], "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8031,6 +8066,13 @@ "items": { "$ref": "#/components/schemas/flight-attendant-identifier-in-request" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8072,6 +8114,13 @@ "items": { "$ref": "#/components/schemas/flight-identifier-in-request" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8113,6 +8162,13 @@ "items": { "$ref": "#/components/schemas/passenger-identifier-in-request" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8155,6 +8211,13 @@ "$ref": "#/components/schemas/flight-attendant-identifier-in-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8198,6 +8261,13 @@ "$ref": "#/components/schemas/data-in-update-airplane-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8214,6 +8284,13 @@ "$ref": "#/components/schemas/data-in-update-flight-attendant-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8230,6 +8307,13 @@ "$ref": "#/components/schemas/data-in-update-flight-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -8246,6 +8330,13 @@ "$ref": "#/components/schemas/data-in-update-passenger-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json index 0ef1436d01..9c5ce3c2a2 100644 --- a/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json @@ -4098,6 +4098,13 @@ "$ref": "#/components/schemas/dataInCreateAccommodationRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4114,6 +4121,13 @@ "$ref": "#/components/schemas/dataInCreateExcursionRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4130,6 +4144,13 @@ "$ref": "#/components/schemas/dataInCreateTransportRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4146,6 +4167,13 @@ "$ref": "#/components/schemas/dataInCreateVacationRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4815,6 +4843,13 @@ } ], "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5084,6 +5119,13 @@ "items": { "$ref": "#/components/schemas/excursionIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5126,6 +5168,13 @@ "$ref": "#/components/schemas/accommodationIdentifierInRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5369,6 +5418,13 @@ "$ref": "#/components/schemas/dataInUpdateAccommodationRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5385,6 +5441,13 @@ "$ref": "#/components/schemas/dataInUpdateExcursionRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5401,6 +5464,13 @@ "$ref": "#/components/schemas/dataInUpdateTransportRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5417,6 +5487,13 @@ "$ref": "#/components/schemas/dataInUpdateVacationRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json index c6c8778a00..31121d3a04 100644 --- a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json +++ b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json @@ -439,6 +439,13 @@ "$ref": "#/components/schemas/dataInCreateSocialMediaAccountRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -872,6 +879,13 @@ "$ref": "#/components/schemas/dataInUpdateSocialMediaAccountRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json index 18845668ca..aa9cff87d4 100644 --- a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json +++ b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json @@ -457,6 +457,13 @@ "$ref": "#/components/schemas/dataInCreateSocialMediaAccountRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -899,6 +906,13 @@ "$ref": "#/components/schemas/dataInUpdateSocialMediaAccountRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json index 75194dc505..279aea9ee8 100644 --- a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json @@ -2871,6 +2871,13 @@ "$ref": "#/components/schemas/dataInCreateStaffMemberRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -2919,6 +2926,13 @@ "$ref": "#/components/schemas/dataInCreateSupermarketRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3435,6 +3449,13 @@ } ], "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4398,6 +4419,13 @@ "items": { "$ref": "#/components/schemas/staffMemberIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4440,6 +4468,13 @@ "$ref": "#/components/schemas/staffMemberIdentifierInRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4528,6 +4563,13 @@ "$ref": "#/components/schemas/dataInUpdateStaffMemberRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4663,6 +4705,13 @@ "$ref": "#/components/schemas/dataInUpdateSupermarketRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json index 2d28c0b1a8..17a5739c70 100644 --- a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json @@ -2871,6 +2871,13 @@ "$ref": "#/components/schemas/data-in-create-staff-member-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -2919,6 +2926,13 @@ "$ref": "#/components/schemas/data-in-create-supermarket-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3435,6 +3449,13 @@ } ], "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4398,6 +4419,13 @@ "items": { "$ref": "#/components/schemas/staff-member-identifier-in-request" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4440,6 +4468,13 @@ "$ref": "#/components/schemas/staff-member-identifier-in-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4528,6 +4563,13 @@ "$ref": "#/components/schemas/data-in-update-staff-member-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4663,6 +4705,13 @@ "$ref": "#/components/schemas/data-in-update-supermarket-request" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json index 6bd3cbce1f..82afc21b7d 100644 --- a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json @@ -2871,6 +2871,13 @@ "$ref": "#/components/schemas/DataInCreateStaffMemberRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false @@ -2919,6 +2926,13 @@ "$ref": "#/components/schemas/DataInCreateSupermarketRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false @@ -3435,6 +3449,13 @@ } ], "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false @@ -4398,6 +4419,13 @@ "items": { "$ref": "#/components/schemas/StaffMemberIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false @@ -4440,6 +4468,13 @@ "$ref": "#/components/schemas/StaffMemberIdentifierInRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false @@ -4528,6 +4563,13 @@ "$ref": "#/components/schemas/DataInUpdateStaffMemberRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false @@ -4663,6 +4705,13 @@ "$ref": "#/components/schemas/DataInUpdateSupermarketRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json index 4d330c3c02..345261b7a1 100644 --- a/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json @@ -3209,6 +3209,13 @@ "$ref": "#/components/schemas/dataInCreateNameValuePairRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3225,6 +3232,13 @@ "$ref": "#/components/schemas/dataInCreateNodeRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4182,6 +4196,13 @@ } ], "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4407,6 +4428,13 @@ "items": { "$ref": "#/components/schemas/nameValuePairIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4448,6 +4476,13 @@ "items": { "$ref": "#/components/schemas/nodeIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4490,6 +4525,13 @@ "$ref": "#/components/schemas/nodeIdentifierInRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4533,6 +4575,13 @@ "$ref": "#/components/schemas/dataInUpdateNameValuePairRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4549,6 +4598,13 @@ "$ref": "#/components/schemas/dataInUpdateNodeRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json index eed41edf37..69d70324be 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json @@ -2651,6 +2651,13 @@ "$ref": "#/components/schemas/dataInCreateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3133,6 +3140,13 @@ } ], "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3536,6 +3550,13 @@ "items": { "$ref": "#/components/schemas/emptyIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3578,6 +3599,13 @@ "$ref": "#/components/schemas/dataInUpdateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json index 130ec0ad92..3bef48d64e 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json @@ -2646,6 +2646,13 @@ "$ref": "#/components/schemas/dataInCreateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3196,6 +3203,13 @@ } ], "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3596,6 +3610,13 @@ "items": { "$ref": "#/components/schemas/emptyIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3638,6 +3659,13 @@ "$ref": "#/components/schemas/emptyIdentifierInRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -3681,6 +3709,13 @@ "$ref": "#/components/schemas/dataInUpdateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json index 7044be963a..fa46e98b83 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json @@ -3518,6 +3518,13 @@ "$ref": "#/components/schemas/dataInCreateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4068,6 +4075,13 @@ } ], "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4521,6 +4535,13 @@ "items": { "$ref": "#/components/schemas/emptyIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4563,6 +4584,13 @@ "$ref": "#/components/schemas/emptyIdentifierInRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4606,6 +4634,13 @@ "$ref": "#/components/schemas/dataInUpdateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json index 805dc7f838..8ff9f644d7 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json @@ -3514,6 +3514,13 @@ "$ref": "#/components/schemas/dataInCreateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4064,6 +4071,13 @@ } ], "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4515,6 +4529,13 @@ "items": { "$ref": "#/components/schemas/emptyIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4557,6 +4578,13 @@ "$ref": "#/components/schemas/emptyIdentifierInRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4600,6 +4628,13 @@ "$ref": "#/components/schemas/dataInUpdateResourceRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false diff --git a/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json index 090e9167b1..f7a268f603 100644 --- a/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json @@ -4120,6 +4120,13 @@ "$ref": "#/components/schemas/dataInCreateWriteOnlyChannelRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -4726,6 +4733,13 @@ } ], "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5247,6 +5261,13 @@ "items": { "$ref": "#/components/schemas/dataStreamIdentifierInRequest" } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5289,6 +5310,13 @@ "$ref": "#/components/schemas/dataStreamIdentifierInRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false @@ -5332,6 +5360,13 @@ "$ref": "#/components/schemas/dataInUpdateWriteOnlyChannelRequest" } ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] } }, "additionalProperties": false From 8bab51a3a3ea885f34aa047348a90ae8cc5650fd Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Thu, 28 Nov 2024 04:46:16 +0100 Subject: [PATCH 6/9] Change discriminator type in dataInResponse from string to ResourceType enum --- .../JsonApiDotNetCoreExample.json | 15 ++++- .../GeneratedCode/Models/DataInResponse.cs | 18 ++---- .../GeneratedCode/Models/ResourceType.cs | 24 ++++++++ .../ConfigureSwaggerGenOptions.cs | 1 + .../JsonApiSchemaIdSelector.cs | 11 ++-- .../AbstractResourceDataSchemaGenerator.cs | 34 +++++++++-- .../StringEnumOrderingFilter.cs | 61 +++++++++++++++++++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++---- .../GeneratedCode/Models/ResourceType.cs | 28 +++++++++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++---- .../GeneratedCode/Models/ResourceType.cs | 24 ++++++++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++---- .../GeneratedCode/Models/ResourceType.cs | 20 ++++++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++---- .../GeneratedCode/Models/ResourceType.cs | 28 +++++++++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++---- .../GeneratedCode/Models/ResourceType.cs | 16 +++++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++---- .../GeneratedCode/Models/ResourceType.cs | 20 ++++++ .../GeneratedCode/Models/DataInResponse.cs | 18 ++---- .../GeneratedCode/Models/ResourceType.cs | 28 +++++++++ .../CamelCase/GeneratedTypesTests.cs | 2 + .../KebabCase/GeneratedTypesTests.cs | 2 + .../PascalCase/GeneratedTypesTests.cs | 2 + .../GeneratedSwagger/swagger.g.json | 16 ++++- .../GeneratedSwagger/swagger.g.json | 15 ++++- .../Headers/GeneratedSwagger/swagger.g.json | 14 ++++- .../GeneratedSwagger/swagger.g.json | 16 ++++- .../LegacyOpenApi/expected-swagger.json | 16 ++++- .../Enabled/GeneratedSwagger/swagger.g.json | 16 ++++- .../GeneratedSwagger/net6.0/swagger.g.json | 13 +++- .../GeneratedSwagger/net8.0/swagger.g.json | 13 +++- .../CamelCase/GeneratedSwagger/swagger.g.json | 14 ++++- .../KebabCase/GeneratedSwagger/swagger.g.json | 14 ++++- .../GeneratedSwagger/swagger.g.json | 14 ++++- .../GeneratedSwagger/swagger.g.json | 14 ++++- .../GeneratedSwagger/swagger.g.json | 14 ++++- .../GeneratedSwagger/swagger.g.json | 14 ++++- .../GeneratedSwagger/swagger.g.json | 14 ++++- .../GeneratedSwagger/swagger.g.json | 14 ++++- .../GeneratedSwagger/swagger.g.json | 16 ++++- 41 files changed, 548 insertions(+), 159 deletions(-) create mode 100644 src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceType.cs create mode 100644 src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/StringEnumOrderingFilter.cs create mode 100644 test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceType.cs create mode 100644 test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceType.cs create mode 100644 test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceType.cs create mode 100644 test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceType.cs create mode 100644 test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceType.cs create mode 100644 test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceType.cs create mode 100644 test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceType.cs diff --git a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json index 315699eadd..e6ed281125 100644 --- a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json +++ b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json @@ -5554,8 +5554,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, "meta": { "allOf": [ @@ -6864,6 +6867,14 @@ }, "additionalProperties": false }, + "resourceType": { + "enum": [ + "people", + "tags", + "todoItems" + ], + "type": "string" + }, "tagAttributesInResponse": { "type": "object", "properties": { diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInResponse.cs index f05ab07050..fa82766160 100644 --- a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInResponse.cs +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInResponse.cs @@ -32,21 +32,11 @@ public partial class DataInResponse : IBackedModel, IParsable } #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 + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? Type { - get { return BackingStore?.Get("type"); } + get { return BackingStore?.Get("type"); } set { BackingStore?.Set("type", value); } } -#endif /// /// Instantiates a new and sets the default values. /// @@ -80,7 +70,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetStringValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, }; } /// @@ -91,7 +81,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("meta", Meta); - writer.WriteStringValue("type", Type); + writer.WriteEnumValue("type", Type); } } } diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceType.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..730f49e728 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,24 @@ +// +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "people")] + #pragma warning disable CS1591 + People, + #pragma warning restore CS1591 + [EnumMember(Value = "tags")] + #pragma warning disable CS1591 + Tags, + #pragma warning restore CS1591 + [EnumMember(Value = "todoItems")] + #pragma warning disable CS1591 + TodoItems, + #pragma warning restore CS1591 + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs index dd8fd06126..45e3d211ce 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs @@ -59,6 +59,7 @@ public void Configure(SwaggerGenOptions options) options.DocumentFilter(); options.DocumentFilter(); + options.DocumentFilter(); options.OperationFilter(); options.DocumentFilter(); } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs index 9f932b9853..82e2fcf6b5 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs @@ -115,10 +115,9 @@ private string ApplySchemaTemplate(string schemaTemplate, ResourceType? resource { string schemaId = schemaTemplate; - if (resourceType != null) - { - schemaId = schemaId.Replace("[ResourceName]", resourceType.PublicName.Singularize()).Pascalize(); - } + schemaId = resourceType != null + ? schemaId.Replace("[ResourceName]", resourceType.PublicName.Singularize()).Pascalize() + : schemaId.Replace("[ResourceName]", "$$$").Pascalize().Replace("$$$", string.Empty); if (relationshipName != null) { @@ -136,10 +135,8 @@ private string ApplySchemaTemplate(string schemaTemplate, ResourceType? resource return namingPolicy != null ? namingPolicy.ConvertName(pascalCaseSchemaId) : pascalCaseSchemaId; } - public string GetResourceTypeSchemaId(ResourceType resourceType) + public string GetResourceTypeSchemaId(ResourceType? resourceType) { - ArgumentGuard.NotNull(resourceType); - return ApplySchemaTemplate(ResourceTypeSchemaIdTemplate, resourceType, null, null); } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs index 3b99ebd43a..a18875868c 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs @@ -35,6 +35,7 @@ public OpenApiSchema GenerateSchema(SchemaRepository schemaRepository) return referenceSchema; } + OpenApiSchema referenceSchemaForResourceType = GenerateEmptyResourceTypeSchema(schemaRepository); OpenApiSchema referenceSchemaForMeta = _metaSchemaGenerator.GenerateSchema(schemaRepository); var fullSchema = new OpenApiSchema @@ -45,8 +46,7 @@ public OpenApiSchema GenerateSchema(SchemaRepository schemaRepository) { [JsonApiPropertyName.Type] = new() { - MinLength = 1, - Type = "string" + AllOf = [referenceSchemaForResourceType] }, [referenceSchemaForMeta.Reference.Id] = referenceSchemaForMeta.WrapInExtendedSchema() }, @@ -70,6 +70,21 @@ public OpenApiSchema GenerateSchema(SchemaRepository schemaRepository) return referenceSchema; } + private OpenApiSchema GenerateEmptyResourceTypeSchema(SchemaRepository schemaRepository) + { + var fullSchema = new OpenApiSchema + { + Type = "string", + Extensions = + { + [StringEnumOrderingFilter.RequiresSortKey] = new OpenApiBoolean(true) + } + }; + + string resourceTypeSchemaId = _schemaIdSelector.GetResourceTypeSchemaId(null); + return schemaRepository.AddDefinition(resourceTypeSchemaId, fullSchema); + } + public void MapDiscriminator(Type resourceDataConstructedType, OpenApiSchema referenceSchemaForResourceData, SchemaRepository schemaRepository) { ArgumentGuard.NotNull(resourceDataConstructedType); @@ -86,9 +101,20 @@ public void MapDiscriminator(Type resourceDataConstructedType, OpenApiSchema ref } OpenApiSchema fullSchemaForAbstractResourceData = schemaRepository.Schemas[referenceSchemaForAbstractResourceData.Reference.Id]; + string dataSchemaId = referenceSchemaForResourceData.Reference.ReferenceV3; + string publicName = resourceTypeInfo.ResourceType.PublicName; - fullSchemaForAbstractResourceData.Discriminator.Mapping[resourceTypeInfo.ResourceType.PublicName] = - referenceSchemaForResourceData.Reference.ReferenceV3; + if (fullSchemaForAbstractResourceData.Discriminator.Mapping.TryAdd(publicName, dataSchemaId)) + { + MapResourceType(publicName, schemaRepository); + } } } + + private void MapResourceType(string publicName, SchemaRepository schemaRepository) + { + string schemaId = _schemaIdSelector.GetResourceTypeSchemaId(null); + OpenApiSchema fullSchema = schemaRepository.Schemas[schemaId]; + fullSchema.Enum.Add(new OpenApiString(publicName)); + } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/StringEnumOrderingFilter.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/StringEnumOrderingFilter.cs new file mode 100644 index 0000000000..7fb235ce59 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/StringEnumOrderingFilter.cs @@ -0,0 +1,61 @@ +using JetBrains.Annotations; +using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Interfaces; +using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Services; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +internal sealed class StringEnumOrderingFilter : IDocumentFilter +{ + internal const string RequiresSortKey = "x-requires-sort"; + + public void Apply(OpenApiDocument document, DocumentFilterContext context) + { + ArgumentGuard.NotNull(document); + ArgumentGuard.NotNull(context); + + var visitor = new OpenApiEnumVisitor(); + var walker = new OpenApiWalker(visitor); + walker.Walk(document); + } + + private sealed class OpenApiEnumVisitor : OpenApiVisitorBase + { + public override void Visit(OpenApiSchema schema) + { + if (schema.Enum.Count > 0) + { + if (HasSortAnnotation(schema)) + { + if (schema.Enum.Count > 1) + { + OrderEnumMembers(schema); + } + } + + schema.Extensions.Remove(RequiresSortKey); + } + } + + private static bool HasSortAnnotation(OpenApiSchema schema) + { + // Order our own enums, but don't touch enums from user-defined resource attributes. + return schema.Extensions.TryGetValue(RequiresSortKey, out IOpenApiExtension? extension) && extension is OpenApiBoolean { Value: true }; + } + + private static void OrderEnumMembers(OpenApiSchema schema) + { + List ordered = schema.Enum.OfType().OrderBy(openApiString => openApiString.Value).Cast().ToList(); + + if (ordered.Count != schema.Enum.Count) + { + throw new UnreachableCodeException(); + } + + schema.Enum = ordered; + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInResponse.cs index 52a2999665..e929b56c39 100644 --- a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInResponse.cs @@ -32,21 +32,11 @@ public partial class DataInResponse : IBackedModel, IParsable } #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 + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? Type { - get { return BackingStore?.Get("type"); } + get { return BackingStore?.Get("type"); } set { BackingStore?.Set("type", value); } } -#endif /// /// Instantiates a new and sets the default values. /// @@ -81,7 +71,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetStringValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, }; } /// @@ -92,7 +82,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("meta", Meta); - writer.WriteStringValue("type", Type); + writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..2bd3d6cfe6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,28 @@ +// +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "courses")] + #pragma warning disable CS1591 + Courses, + #pragma warning restore CS1591 + [EnumMember(Value = "enrollments")] + #pragma warning disable CS1591 + Enrollments, + #pragma warning restore CS1591 + [EnumMember(Value = "students")] + #pragma warning disable CS1591 + Students, + #pragma warning restore CS1591 + [EnumMember(Value = "teachers")] + #pragma warning disable CS1591 + Teachers, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInResponse.cs index b64ad60d33..fff6a58ec4 100644 --- a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInResponse.cs @@ -32,21 +32,11 @@ public partial class DataInResponse : IBackedModel, IParsable } #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 + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceType? Type { - get { return BackingStore?.Get("type"); } + get { return BackingStore?.Get("type"); } set { BackingStore?.Set("type", value); } } -#endif /// /// Instantiates a new and sets the default values. /// @@ -80,7 +70,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetStringValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, }; } /// @@ -91,7 +81,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("meta", Meta); - writer.WriteStringValue("type", Type); + writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..1ca0b68504 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,24 @@ +// +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "games")] + #pragma warning disable CS1591 + Games, + #pragma warning restore CS1591 + [EnumMember(Value = "playerGroups")] + #pragma warning disable CS1591 + PlayerGroups, + #pragma warning restore CS1591 + [EnumMember(Value = "players")] + #pragma warning disable CS1591 + Players, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInResponse.cs index 6ed79aade8..fa0d56b626 100644 --- a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInResponse.cs @@ -32,21 +32,11 @@ public partial class DataInResponse : IBackedModel, IParsable } #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 + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? Type { - get { return BackingStore?.Get("type"); } + get { return BackingStore?.Get("type"); } set { BackingStore?.Set("type", value); } } -#endif /// /// Instantiates a new and sets the default values. /// @@ -79,7 +69,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetStringValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, }; } /// @@ -90,7 +80,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("meta", Meta); - writer.WriteStringValue("type", Type); + writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..e5e44511d0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,20 @@ +// +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "countries")] + #pragma warning disable CS1591 + Countries, + #pragma warning restore CS1591 + [EnumMember(Value = "languages")] + #pragma warning disable CS1591 + Languages, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInResponse.cs index 2b631857ba..07ad81c11f 100644 --- a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInResponse.cs @@ -32,21 +32,11 @@ public partial class DataInResponse : IBackedModel, IParsable } #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 + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? Type { - get { return BackingStore?.Get("type"); } + get { return BackingStore?.Get("type"); } set { BackingStore?.Set("type", value); } } -#endif /// /// Instantiates a new and sets the default values. /// @@ -81,7 +71,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetStringValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, }; } /// @@ -92,7 +82,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("meta", Meta); - writer.WriteStringValue("type", Type); + writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..3422d8708b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,28 @@ +// +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "accommodations")] + #pragma warning disable CS1591 + Accommodations, + #pragma warning restore CS1591 + [EnumMember(Value = "excursions")] + #pragma warning disable CS1591 + Excursions, + #pragma warning restore CS1591 + [EnumMember(Value = "transports")] + #pragma warning disable CS1591 + Transports, + #pragma warning restore CS1591 + [EnumMember(Value = "vacations")] + #pragma warning disable CS1591 + Vacations, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInResponse.cs index 5e083e3df9..b678137ce2 100644 --- a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInResponse.cs @@ -32,21 +32,11 @@ public partial class DataInResponse : IBackedModel, IParsable } #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 + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceType? Type { - get { return BackingStore?.Get("type"); } + get { return BackingStore?.Get("type"); } set { BackingStore?.Set("type", value); } } -#endif /// /// Instantiates a new and sets the default values. /// @@ -78,7 +68,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetStringValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, }; } /// @@ -89,7 +79,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("meta", Meta); - writer.WriteStringValue("type", Type); + writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..a0b6ee9729 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,16 @@ +// +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "socialMediaAccounts")] + #pragma warning disable CS1591 + SocialMediaAccounts, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInResponse.cs index 56a96e996d..ddaf4edb8a 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInResponse.cs @@ -32,21 +32,11 @@ public partial class DataInResponse : IBackedModel, IParsable } #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 + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? Type { - get { return BackingStore?.Get("type"); } + get { return BackingStore?.Get("type"); } set { BackingStore?.Set("type", value); } } -#endif /// /// Instantiates a new and sets the default values. /// @@ -79,7 +69,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetStringValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, }; } /// @@ -90,7 +80,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("meta", Meta); - writer.WriteStringValue("type", Type); + writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..be23605b11 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,20 @@ +// +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "nameValuePairs")] + #pragma warning disable CS1591 + NameValuePairs, + #pragma warning restore CS1591 + [EnumMember(Value = "nodes")] + #pragma warning disable CS1591 + Nodes, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInResponse.cs index f09e4494a4..b4754f455d 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInResponse.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInResponse.cs @@ -32,21 +32,11 @@ public partial class DataInResponse : IBackedModel, IParsable } #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 + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? Type { - get { return BackingStore?.Get("type"); } + get { return BackingStore?.Get("type"); } set { BackingStore?.Set("type", value); } } -#endif /// /// Instantiates a new and sets the default values. /// @@ -81,7 +71,7 @@ public virtual IDictionary> GetFieldDeserializers() return new Dictionary> { { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, - { "type", n => { Type = n.GetStringValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, }; } /// @@ -92,7 +82,7 @@ public virtual void Serialize(ISerializationWriter writer) { _ = writer ?? throw new ArgumentNullException(nameof(writer)); writer.WriteObjectValue("meta", Meta); - writer.WriteStringValue("type", Type); + writer.WriteEnumValue("type", Type); } } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..a522e6b321 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,28 @@ +// +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "dataStreams")] + #pragma warning disable CS1591 + DataStreams, + #pragma warning restore CS1591 + [EnumMember(Value = "readOnlyChannels")] + #pragma warning disable CS1591 + ReadOnlyChannels, + #pragma warning restore CS1591 + [EnumMember(Value = "readOnlyResourceChannels")] + #pragma warning disable CS1591 + ReadOnlyResourceChannels, + #pragma warning restore CS1591 + [EnumMember(Value = "writeOnlyChannels")] + #pragma warning disable CS1591 + WriteOnlyChannels, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs index 196c22f6b7..e4eb1c5887 100644 --- a/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs +++ b/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs @@ -155,6 +155,8 @@ public void Generated_resource_type_enums_are_named_as_expected() { _ = nameof(SupermarketResourceType.Supermarkets); _ = nameof(StaffMemberResourceType.StaffMembers); + _ = nameof(ResourceType.Supermarkets); + _ = nameof(ResourceType.StaffMembers); } [Fact] diff --git a/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs index dbfdefa39d..1bc37be106 100644 --- a/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs +++ b/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs @@ -155,6 +155,8 @@ public void Generated_resource_type_enums_are_named_as_expected() { _ = nameof(SupermarketResourceType.Supermarkets); _ = nameof(StaffMemberResourceType.StaffMembers); + _ = nameof(ResourceType.Supermarkets); + _ = nameof(ResourceType.StaffMembers); } [Fact] diff --git a/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs index 85aec10a24..af51fad478 100644 --- a/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs +++ b/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs @@ -155,6 +155,8 @@ public void Generated_resource_type_enums_are_named_as_expected() { _ = nameof(SupermarketResourceType.Supermarkets); _ = nameof(StaffMemberResourceType.StaffMembers); + _ = nameof(ResourceType.Supermarkets); + _ = nameof(ResourceType.StaffMembers); } [Fact] diff --git a/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json index df83a02810..60401db8d4 100644 --- a/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json @@ -7518,8 +7518,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, "meta": { "allOf": [ @@ -8918,6 +8921,15 @@ }, "additionalProperties": false }, + "resourceType": { + "enum": [ + "courses", + "enrollments", + "students", + "teachers" + ], + "type": "string" + }, "studentAttributesInResponse": { "type": "object", "properties": { diff --git a/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json index 5812f34dbc..bd06d3e570 100644 --- a/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json @@ -566,8 +566,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, "meta": { "allOf": [ @@ -1271,6 +1274,14 @@ }, "additionalProperties": false }, + "resourceType": { + "enum": [ + "games", + "playerGroups", + "players" + ], + "type": "string" + }, "toManyGameInRequest": { "required": [ "data" diff --git a/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json index e1f7f77a46..65b8fd672e 100644 --- a/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json @@ -1394,8 +1394,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, "meta": { "allOf": [ @@ -1874,6 +1877,13 @@ }, "additionalProperties": false }, + "resourceType": { + "enum": [ + "countries", + "languages" + ], + "type": "string" + }, "toManyLanguageInRequest": { "required": [ "data" diff --git a/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json index 98ff878ac9..4f6c2e5873 100644 --- a/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json @@ -6456,8 +6456,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] }, "meta": { "allOf": [ @@ -8055,6 +8058,15 @@ }, "additionalProperties": false }, + "resource-type": { + "enum": [ + "airplanes", + "flight-attendants", + "flights", + "passengers" + ], + "type": "string" + }, "to-many-flight-attendant-in-request": { "required": [ "data" diff --git a/test/OpenApiTests/LegacyOpenApi/expected-swagger.json b/test/OpenApiTests/LegacyOpenApi/expected-swagger.json index 98ff878ac9..4f6c2e5873 100644 --- a/test/OpenApiTests/LegacyOpenApi/expected-swagger.json +++ b/test/OpenApiTests/LegacyOpenApi/expected-swagger.json @@ -6456,8 +6456,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] }, "meta": { "allOf": [ @@ -8055,6 +8058,15 @@ }, "additionalProperties": false }, + "resource-type": { + "enum": [ + "airplanes", + "flight-attendants", + "flights", + "passengers" + ], + "type": "string" + }, "to-many-flight-attendant-in-request": { "required": [ "data" diff --git a/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json index 9c5ce3c2a2..a4ae28420d 100644 --- a/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json @@ -4312,8 +4312,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, "meta": { "allOf": [ @@ -5108,6 +5111,15 @@ }, "additionalProperties": false }, + "resourceType": { + "enum": [ + "accommodations", + "excursions", + "transports", + "vacations" + ], + "type": "string" + }, "toManyExcursionInRequest": { "required": [ "data" diff --git a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json index 31121d3a04..87835d7ef5 100644 --- a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json +++ b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net6.0/swagger.g.json @@ -487,8 +487,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, "meta": { "allOf": [ @@ -692,6 +695,12 @@ }, "additionalProperties": false }, + "resourceType": { + "enum": [ + "socialMediaAccounts" + ], + "type": "string" + }, "socialMediaAccountAttributesInResponse": { "type": "object", "properties": { diff --git a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json index aa9cff87d4..28dd13c8a8 100644 --- a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json +++ b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/net8.0/swagger.g.json @@ -505,8 +505,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, "meta": { "allOf": [ @@ -710,6 +713,12 @@ }, "additionalProperties": false }, + "resourceType": { + "enum": [ + "socialMediaAccounts" + ], + "type": "string" + }, "socialMediaAccountAttributesInResponse": { "type": "object", "properties": { diff --git a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json index 279aea9ee8..52afa1a60c 100644 --- a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json @@ -3019,8 +3019,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, "meta": { "allOf": [ @@ -3750,6 +3753,13 @@ }, "additionalProperties": false }, + "resourceType": { + "enum": [ + "staffMembers", + "supermarkets" + ], + "type": "string" + }, "staffMemberAttributesInResponse": { "type": "object", "properties": { diff --git a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json index 17a5739c70..883b69cc33 100644 --- a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json @@ -3019,8 +3019,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] }, "meta": { "allOf": [ @@ -3750,6 +3753,13 @@ }, "additionalProperties": false }, + "resource-type": { + "enum": [ + "staff-members", + "supermarkets" + ], + "type": "string" + }, "staff-member-attributes-in-response": { "type": "object", "properties": { diff --git a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json index 82afc21b7d..74bb6e8566 100644 --- a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json @@ -3019,8 +3019,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] }, "Meta": { "allOf": [ @@ -3750,6 +3753,13 @@ }, "additionalProperties": false }, + "ResourceType": { + "enum": [ + "StaffMembers", + "Supermarkets" + ], + "type": "string" + }, "StaffMemberAttributesInResponse": { "type": "object", "properties": { diff --git a/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json index 345261b7a1..1183daf0ca 100644 --- a/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json @@ -3324,8 +3324,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, "meta": { "allOf": [ @@ -4417,6 +4420,13 @@ }, "additionalProperties": false }, + "resourceType": { + "enum": [ + "nameValuePairs", + "nodes" + ], + "type": "string" + }, "toManyNameValuePairInRequest": { "required": [ "data" diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json index 69d70324be..1029234d88 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json @@ -2706,8 +2706,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, "meta": { "allOf": [ @@ -3539,6 +3542,13 @@ }, "additionalProperties": false }, + "resourceType": { + "enum": [ + "empties", + "resources" + ], + "type": "string" + }, "toManyEmptyInRequest": { "required": [ "data" diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json index 3bef48d64e..247346ce76 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json @@ -2701,8 +2701,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, "meta": { "allOf": [ @@ -3599,6 +3602,13 @@ }, "additionalProperties": false }, + "resourceType": { + "enum": [ + "empties", + "resources" + ], + "type": "string" + }, "toManyEmptyInRequest": { "required": [ "data" diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json index fa46e98b83..f0c1292a07 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json @@ -3573,8 +3573,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, "meta": { "allOf": [ @@ -4524,6 +4527,13 @@ }, "additionalProperties": false }, + "resourceType": { + "enum": [ + "empties", + "resources" + ], + "type": "string" + }, "toManyEmptyInRequest": { "required": [ "data" diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json index 8ff9f644d7..0fda370b65 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json @@ -3569,8 +3569,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, "meta": { "allOf": [ @@ -4518,6 +4521,13 @@ }, "additionalProperties": false }, + "resourceType": { + "enum": [ + "empties", + "resources" + ], + "type": "string" + }, "toManyEmptyInRequest": { "required": [ "data" diff --git a/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json index f7a268f603..08e720c82b 100644 --- a/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json +++ b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json @@ -4175,8 +4175,11 @@ "type": "object", "properties": { "type": { - "minLength": 1, - "type": "string" + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] }, "meta": { "allOf": [ @@ -5250,6 +5253,15 @@ }, "additionalProperties": false }, + "resourceType": { + "enum": [ + "dataStreams", + "readOnlyChannels", + "readOnlyResourceChannels", + "writeOnlyChannels" + ], + "type": "string" + }, "toManyDataStreamInRequest": { "required": [ "data" From 732e52c9e8c736a5f37c6036065ed87dc33aa223 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Fri, 29 Nov 2024 00:47:07 +0100 Subject: [PATCH 7/9] Simplify assertions --- .../QueryStrings/IncludeTests.cs | 34 +++++++------------ .../CreateResourceTests.cs | 19 +++++++---- .../UpdateResourceTests.cs | 4 +-- .../QueryStrings/IncludeTests.cs | 33 +++++++----------- .../CreateResourceTests.cs | 19 +++++++---- .../UpdateResourceTests.cs | 4 +-- 6 files changed, 51 insertions(+), 62 deletions(-) diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/IncludeTests.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/IncludeTests.cs index 71b2b930ff..99880c5945 100644 --- a/test/OpenApiKiotaEndToEndTests/QueryStrings/IncludeTests.cs +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/IncludeTests.cs @@ -58,12 +58,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.ElementAt(0).Id.Should().Be(node.StringId); response.Included.ShouldHaveCount(2); - - response.Included.Should().ContainSingle(include => - include is NameValuePairDataInResponse && ((NameValuePairDataInResponse)include).Id == node.Values.ElementAt(0).StringId); - - response.Included.Should().ContainSingle(include => - include is NameValuePairDataInResponse && ((NameValuePairDataInResponse)include).Id == node.Values.ElementAt(1).StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Values.ElementAt(0).StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Values.ElementAt(1).StringId); } } @@ -101,15 +97,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.Id.Should().Be(node.StringId); response.Included.ShouldHaveCount(3); - - response.Included.Should().ContainSingle(include => - include is NodeDataInResponse && ((NodeDataInResponse)include).Id == node.Children.ElementAt(0).StringId); - - response.Included.Should().ContainSingle(include => - include is NodeDataInResponse && ((NodeDataInResponse)include).Id == node.Children.ElementAt(1).StringId); - - response.Included.Should().ContainSingle(include => - include is NameValuePairDataInResponse && ((NameValuePairDataInResponse)include).Id == node.Values[0].StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Children.ElementAt(0).StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Children.ElementAt(1).StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Values[0].StringId); } } @@ -146,8 +136,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.ShouldHaveCount(2); response.Included.ShouldHaveCount(2); - response.Included.Should().ContainSingle(include => include is NodeDataInResponse && ((NodeDataInResponse)include).Id == node.StringId); - response.Included.Should().ContainSingle(include => include is NodeDataInResponse && ((NodeDataInResponse)include).Id == node.Parent.StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Parent.StringId); } } @@ -186,10 +176,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Included.ShouldHaveCount(1); - NodeDataInResponse include = response.Included.ElementAt(0).Should().BeOfType().Subject; - include.Id.Should().Be(node.Parent.Parent.StringId); - include.Attributes.ShouldNotBeNull(); - include.Attributes.Name.Should().Be(node.Parent.Parent.Name); + response.Included.OfType().Should().ContainSingle(nodeData => nodeData.Id == node.Parent.Parent.StringId).Subject.With( + nodeData => + { + nodeData.Attributes.ShouldNotBeNull(); + nodeData.Attributes.Name.Should().Be(node.Parent.Parent.Name); + }); } } diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs index 038d49c099..f3f95e48ca 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs @@ -108,15 +108,20 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.Relationships.AudioStreams.Data.ElementAt(0).Id.Should().Be(existingAudioStream.StringId); response.Included.ShouldHaveCount(2); - DataStreamDataInResponse[] dataStreamIncludes = response.Included.OfType().ToArray(); - DataStreamDataInResponse videoStream = dataStreamIncludes.Single(include => include.Id == existingVideoStream.StringId); - videoStream.Attributes.ShouldNotBeNull(); - videoStream.Attributes.BytesTransmitted.Should().Be((long?)existingVideoStream.BytesTransmitted); + response.Included.OfType().Should().ContainSingle(streamData => streamData.Id == existingVideoStream.StringId).Subject + .With(streamData => + { + streamData.Attributes.ShouldNotBeNull(); + streamData.Attributes.BytesTransmitted.Should().Be((long?)existingVideoStream.BytesTransmitted); + }); - DataStreamDataInResponse audioStream = dataStreamIncludes.Single(include => include.Id == existingAudioStream.StringId); - audioStream.Attributes.ShouldNotBeNull(); - audioStream.Attributes.BytesTransmitted.Should().Be((long?)existingAudioStream.BytesTransmitted); + response.Included.OfType().Should().ContainSingle(streamData => streamData.Id == existingAudioStream.StringId).Subject + .With(streamData => + { + streamData.Attributes.ShouldNotBeNull(); + streamData.Attributes.BytesTransmitted.Should().Be((long?)existingAudioStream.BytesTransmitted); + }); long newChannelId = long.Parse(response.Data.Id.ShouldNotBeNull()); diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateResourceTests.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateResourceTests.cs index 755ac23c6d..762f076781 100644 --- a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateResourceTests.cs +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateResourceTests.cs @@ -114,9 +114,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.Relationships.AudioStreams.Data.Should().BeEmpty(); response.Included.ShouldHaveCount(1); - - DataStreamDataInResponse? videoStream = response.Included.ElementAt(0).Should().BeOfType().Which; - videoStream.Id.Should().Be(existingVideoStream.StringId); + response.Included.OfType().Should().ContainSingle(streamData => streamData.Id == existingVideoStream.StringId); await _testContext.RunOnDatabaseAsync(async dbContext => { diff --git a/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs b/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs index 3952a347d1..9cba66d766 100644 --- a/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs +++ b/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs @@ -53,12 +53,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.ElementAt(0).Id.Should().Be(node.StringId); response.Included.ShouldHaveCount(2); - - response.Included.Should().ContainSingle(include => - include is NameValuePairDataInResponse && ((NameValuePairDataInResponse)include).Id == node.Values.ElementAt(0).StringId); - - response.Included.Should().ContainSingle(include => - include is NameValuePairDataInResponse && ((NameValuePairDataInResponse)include).Id == node.Values.ElementAt(1).StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Values.ElementAt(0).StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Values.ElementAt(1).StringId); } [Fact] @@ -91,15 +87,9 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.Id.Should().Be(node.StringId); response.Included.ShouldHaveCount(3); - - response.Included.Should().ContainSingle(include => - include is NodeDataInResponse && ((NodeDataInResponse)include).Id == node.Children.ElementAt(0).StringId); - - response.Included.Should().ContainSingle(include => - include is NodeDataInResponse && ((NodeDataInResponse)include).Id == node.Children.ElementAt(1).StringId); - - response.Included.Should().ContainSingle(include => - include is NameValuePairDataInResponse && ((NameValuePairDataInResponse)include).Id == node.Values[0].StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Children.ElementAt(0).StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Children.ElementAt(1).StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Values[0].StringId); } [Fact] @@ -132,8 +122,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.ShouldHaveCount(2); response.Included.ShouldHaveCount(2); - response.Included.Should().ContainSingle(include => include is NodeDataInResponse && ((NodeDataInResponse)include).Id == node.StringId); - response.Included.Should().ContainSingle(include => include is NodeDataInResponse && ((NodeDataInResponse)include).Id == node.Parent.StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Parent.StringId); } [Fact] @@ -168,10 +158,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Included.ShouldHaveCount(1); - NodeDataInResponse include = response.Included.ElementAt(0).Should().BeOfType().Subject; - include.Id.Should().Be(node.Parent.Parent.StringId); - include.Attributes.ShouldNotBeNull(); - include.Attributes.Name.Should().Be(node.Parent.Parent.Name); + response.Included.OfType().Should().ContainSingle(nodeData => nodeData.Id == node.Parent.Parent.StringId).Subject.With(nodeData => + { + nodeData.Attributes.ShouldNotBeNull(); + nodeData.Attributes.Name.Should().Be(node.Parent.Parent.Name); + }); } [Fact] diff --git a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs index 61e1e9df1e..fae8c9b8dd 100644 --- a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs +++ b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs @@ -102,15 +102,20 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.Relationships.AudioStreams.Data.ElementAt(0).Id.Should().Be(existingAudioStream.StringId); response.Included.ShouldHaveCount(2); - DataStreamDataInResponse[] dataStreamIncludes = response.Included.OfType().ToArray(); - DataStreamDataInResponse videoStream = dataStreamIncludes.Single(include => include.Id == existingVideoStream.StringId); - videoStream.Attributes.ShouldNotBeNull(); - videoStream.Attributes.BytesTransmitted.Should().Be((long?)existingVideoStream.BytesTransmitted); + response.Included.OfType().Should().ContainSingle(streamData => streamData.Id == existingVideoStream.StringId).Subject.With( + streamData => + { + streamData.Attributes.ShouldNotBeNull(); + streamData.Attributes.BytesTransmitted.Should().Be((long?)existingVideoStream.BytesTransmitted); + }); - DataStreamDataInResponse audioStream = dataStreamIncludes.Single(include => include.Id == existingAudioStream.StringId); - audioStream.Attributes.ShouldNotBeNull(); - audioStream.Attributes.BytesTransmitted.Should().Be((long?)existingAudioStream.BytesTransmitted); + response.Included.OfType().Should().ContainSingle(streamData => streamData.Id == existingAudioStream.StringId).Subject.With( + streamData => + { + streamData.Attributes.ShouldNotBeNull(); + streamData.Attributes.BytesTransmitted.Should().Be((long?)existingAudioStream.BytesTransmitted); + }); long newChannelId = long.Parse(response.Data.Id.ShouldNotBeNull()); diff --git a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/UpdateResourceTests.cs b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/UpdateResourceTests.cs index e50e538677..2bb61cfccf 100644 --- a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/UpdateResourceTests.cs +++ b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/UpdateResourceTests.cs @@ -109,9 +109,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => response.Data.Relationships.AudioStreams.Data.Should().BeEmpty(); response.Included.ShouldHaveCount(1); - - DataStreamDataInResponse? videoStream = response.Included.ElementAt(0).Should().BeOfType().Which; - videoStream.Id.Should().Be(existingVideoStream.StringId); + response.Included.OfType().Should().ContainSingle(streamData => streamData.Id == existingVideoStream.StringId); await _testContext.RunOnDatabaseAsync(async dbContext => { From 5454188573af1ae1c49d2c965cacebc95021049c Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Fri, 29 Nov 2024 01:23:17 +0100 Subject: [PATCH 8/9] Rename ResourceTypeInfo to ResourceSchemaType --- ...sourceOrRelationshipBodySchemaGenerator.cs | 8 +-- .../AbstractResourceDataSchemaGenerator.cs | 6 +-- .../DataContainerSchemaGenerator.cs | 4 +- .../Components/DataSchemaGenerator.cs | 28 +++++----- .../LinksVisibilitySchemaGenerator.cs | 6 +-- .../ResourceFieldSchemaBuilder.cs | 51 +++++++++++-------- .../SwaggerComponents/ResourceSchemaType.cs | 42 +++++++++++++++ .../SwaggerComponents/ResourceTypeInfo.cs | 32 ------------ 8 files changed, 100 insertions(+), 77 deletions(-) create mode 100644 src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceSchemaType.cs delete mode 100644 src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceTypeInfo.cs diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/ResourceOrRelationshipBodySchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/ResourceOrRelationshipBodySchemaGenerator.cs index eadabfb467..f25530d4d8 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/ResourceOrRelationshipBodySchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/ResourceOrRelationshipBodySchemaGenerator.cs @@ -67,15 +67,15 @@ protected override OpenApiSchema GenerateBodySchema(Type bodyType, SchemaReposit return referenceSchemaForBody; } - var resourceTypeInfo = ResourceTypeInfo.Create(bodyType, _resourceGraph); - bool isRequestSchema = RequestBodySchemaTypes.Contains(bodyType.ConstructedToOpenType()); + var resourceSchemaType = ResourceSchemaType.Create(bodyType, _resourceGraph); + bool isRequestSchema = RequestBodySchemaTypes.Contains(resourceSchemaType.SchemaOpenType); - _ = _dataContainerSchemaGenerator.GenerateSchema(bodyType, resourceTypeInfo.ResourceType, isRequestSchema, schemaRepository); + _ = _dataContainerSchemaGenerator.GenerateSchema(bodyType, resourceSchemaType.ResourceType, isRequestSchema, schemaRepository); referenceSchemaForBody = _defaultSchemaGenerator.GenerateSchema(bodyType, schemaRepository); OpenApiSchema fullSchemaForBody = schemaRepository.Schemas[referenceSchemaForBody.Reference.Id].UnwrapLastExtendedSchema(); - if (JsonApiSchemaFacts.HasNullableDataProperty(bodyType)) + if (JsonApiSchemaFacts.HasNullableDataProperty(resourceSchemaType.SchemaOpenType)) { fullSchemaForBody.Properties[JsonApiPropertyName.Data].Nullable = true; } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs index a18875868c..537606a024 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AbstractResourceDataSchemaGenerator.cs @@ -91,9 +91,9 @@ public void MapDiscriminator(Type resourceDataConstructedType, OpenApiSchema ref ArgumentGuard.NotNull(referenceSchemaForResourceData); ArgumentGuard.NotNull(schemaRepository); - var resourceTypeInfo = ResourceTypeInfo.Create(resourceDataConstructedType, _resourceGraph); + var resourceSchemaType = ResourceSchemaType.Create(resourceDataConstructedType, _resourceGraph); - if (resourceTypeInfo.ResourceDataOpenType == typeof(ResourceDataInResponse<>)) + if (resourceSchemaType.SchemaOpenType == typeof(ResourceDataInResponse<>)) { if (!schemaRepository.TryLookupByType(ResourceDataAbstractType, out OpenApiSchema? referenceSchemaForAbstractResourceData)) { @@ -102,7 +102,7 @@ public void MapDiscriminator(Type resourceDataConstructedType, OpenApiSchema ref OpenApiSchema fullSchemaForAbstractResourceData = schemaRepository.Schemas[referenceSchemaForAbstractResourceData.Reference.Id]; string dataSchemaId = referenceSchemaForResourceData.Reference.ReferenceV3; - string publicName = resourceTypeInfo.ResourceType.PublicName; + string publicName = resourceSchemaType.ResourceType.PublicName; if (fullSchemaForAbstractResourceData.Discriminator.Mapping.TryAdd(publicName, dataSchemaId)) { diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataContainerSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataContainerSchemaGenerator.cs index 800d1c2de1..c45ada61a7 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataContainerSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataContainerSchemaGenerator.cs @@ -101,9 +101,9 @@ private void EnsureResourceDataInResponseDerivedTypesAreMappedInDiscriminator(Ty if (dataOpenType == typeof(ResourceDataInResponse<>)) { - var resourceTypeInfo = ResourceTypeInfo.Create(dataConstructedType, _resourceGraph); + var resourceSchemaType = ResourceSchemaType.Create(dataConstructedType, _resourceGraph); - foreach (ResourceType relatedType in _includeDependencyScanner.GetReachableRelatedTypes(resourceTypeInfo.ResourceType)) + foreach (ResourceType relatedType in _includeDependencyScanner.GetReachableRelatedTypes(resourceSchemaType.ResourceType)) { MapResourceDataInResponseDerivedTypeInDiscriminator(relatedType, schemaRepository); } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs index 590251b68a..2ec44c83cd 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs @@ -74,8 +74,8 @@ public OpenApiSchema GenerateSchema(Type dataSchemaType, SchemaRepository schema return referenceSchemaForData; } - var resourceTypeInfo = ResourceTypeInfo.Create(dataSchemaType, _resourceGraph); - ResourceType resourceType = resourceTypeInfo.ResourceType; + var resourceSchemaType = ResourceSchemaType.Create(dataSchemaType, _resourceGraph); + ResourceType resourceType = resourceSchemaType.ResourceType; referenceSchemaForData = _defaultSchemaGenerator.GenerateSchema(dataSchemaType, schemaRepository); OpenApiSchema fullSchemaForResourceData = schemaRepository.Schemas[referenceSchemaForData.Reference.Id]; @@ -86,11 +86,11 @@ public OpenApiSchema GenerateSchema(Type dataSchemaType, SchemaRepository schema SetAbstract(inlineSchemaForResourceData, resourceType); SetResourceType(inlineSchemaForResourceData, resourceType, schemaRepository); - AdaptResourceIdentity(inlineSchemaForResourceData, resourceTypeInfo, isRequestSchema, schemaRepository); + AdaptResourceIdentity(inlineSchemaForResourceData, resourceSchemaType, isRequestSchema, schemaRepository); SetResourceId(inlineSchemaForResourceData, resourceType, schemaRepository); - SetResourceFields(inlineSchemaForResourceData, resourceTypeInfo, isRequestSchema, schemaRepository); + SetResourceFields(inlineSchemaForResourceData, resourceSchemaType, isRequestSchema, schemaRepository); SetDocumentation(fullSchemaForResourceData, resourceType); - SetLinksVisibility(inlineSchemaForResourceData, resourceTypeInfo, schemaRepository); + SetLinksVisibility(inlineSchemaForResourceData, resourceSchemaType, schemaRepository); inlineSchemaForResourceData.ReorderProperties(ResourceDataPropertyNamesInOrder); @@ -114,7 +114,8 @@ private void SetResourceType(OpenApiSchema fullSchema, ResourceType resourceType } } - private void AdaptResourceIdentity(OpenApiSchema fullSchema, ResourceTypeInfo resourceTypeInfo, bool forRequestSchema, SchemaRepository schemaRepository) + private void AdaptResourceIdentity(OpenApiSchema fullSchema, ResourceSchemaType resourceSchemaType, bool forRequestSchema, + SchemaRepository schemaRepository) { if (!forRequestSchema) { @@ -128,9 +129,9 @@ private void AdaptResourceIdentity(OpenApiSchema fullSchema, ResourceTypeInfo re fullSchema.Properties.Remove(JsonApiPropertyName.Lid); } - if (resourceTypeInfo.ResourceDataOpenType == typeof(DataInCreateResourceRequest<>)) + if (resourceSchemaType.SchemaOpenType == typeof(DataInCreateResourceRequest<>)) { - ClientIdGenerationMode clientIdGeneration = resourceTypeInfo.ResourceType.ClientIdGeneration ?? _options.ClientIdGeneration; + ClientIdGenerationMode clientIdGeneration = resourceSchemaType.ResourceType.ClientIdGeneration ?? _options.ClientIdGeneration; if (hasAtomicOperationsEndpoint) { @@ -174,7 +175,8 @@ private void SetResourceId(OpenApiSchema fullSchema, ResourceType resourceType, } } - private void SetResourceFields(OpenApiSchema fullSchemaForData, ResourceTypeInfo resourceTypeInfo, bool forRequestSchema, SchemaRepository schemaRepository) + private void SetResourceFields(OpenApiSchema fullSchemaForData, ResourceSchemaType resourceSchemaType, bool forRequestSchema, + SchemaRepository schemaRepository) { bool schemaHasFields = fullSchemaForData.Properties.ContainsKey(JsonApiPropertyName.Attributes) && fullSchemaForData.Properties.ContainsKey(JsonApiPropertyName.Relationships); @@ -182,9 +184,9 @@ private void SetResourceFields(OpenApiSchema fullSchemaForData, ResourceTypeInfo if (schemaHasFields) { var fieldSchemaBuilder = new ResourceFieldSchemaBuilder(_defaultSchemaGenerator, _resourceIdentifierSchemaGenerator, - _linksVisibilitySchemaGenerator, _resourceFieldValidationMetadataProvider, _relationshipTypeFactory, resourceTypeInfo); + _linksVisibilitySchemaGenerator, _resourceFieldValidationMetadataProvider, _relationshipTypeFactory, resourceSchemaType); - ResourceType resourceType = resourceTypeInfo.ResourceType; + ResourceType resourceType = resourceSchemaType.ResourceType; SetFieldSchemaMembers(fullSchemaForData, resourceType, forRequestSchema, true, fieldSchemaBuilder, schemaRepository); SetFieldSchemaMembers(fullSchemaForData, resourceType, forRequestSchema, false, fieldSchemaBuilder, schemaRepository); @@ -222,8 +224,8 @@ private void SetDocumentation(OpenApiSchema fullSchema, ResourceType resourceTyp fullSchema.Description = _resourceDocumentationReader.GetDocumentationForType(resourceType); } - private void SetLinksVisibility(OpenApiSchema fullSchema, ResourceTypeInfo resourceTypeInfo, SchemaRepository schemaRepository) + private void SetLinksVisibility(OpenApiSchema fullSchema, ResourceSchemaType resourceSchemaType, SchemaRepository schemaRepository) { - _linksVisibilitySchemaGenerator.UpdateSchemaForResource(resourceTypeInfo, fullSchema, schemaRepository); + _linksVisibilitySchemaGenerator.UpdateSchemaForResource(resourceSchemaType, fullSchema, schemaRepository); } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs index 4414c236e8..e91df48102 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs @@ -83,12 +83,12 @@ public void UpdateSchemaForTopLevel(Type modelType, OpenApiSchema fullSchemaForL } } - public void UpdateSchemaForResource(ResourceTypeInfo resourceTypeInfo, OpenApiSchema fullSchemaForResourceData, SchemaRepository schemaRepository) + public void UpdateSchemaForResource(ResourceSchemaType resourceSchemaType, OpenApiSchema fullSchemaForResourceData, SchemaRepository schemaRepository) { - ArgumentGuard.NotNull(resourceTypeInfo); + ArgumentGuard.NotNull(resourceSchemaType); ArgumentGuard.NotNull(fullSchemaForResourceData); - if (LinksInJsonApiSchemaTypes.TryGetValue(resourceTypeInfo.ResourceDataOpenType, out LinkTypes possibleLinkTypes)) + if (LinksInJsonApiSchemaTypes.TryGetValue(resourceSchemaType.SchemaOpenType, out LinkTypes possibleLinkTypes)) { UpdateLinksProperty(fullSchemaForResourceData, _lazyLinksVisibility.Value.ResourceLinks, possibleLinkTypes, schemaRepository); } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceFieldSchemaBuilder.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceFieldSchemaBuilder.cs index 921c19ea98..10750d08cd 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceFieldSchemaBuilder.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceFieldSchemaBuilder.cs @@ -13,7 +13,7 @@ internal sealed class ResourceFieldSchemaBuilder private readonly SchemaGenerator _defaultSchemaGenerator; private readonly ResourceIdentifierSchemaGenerator _resourceIdentifierSchemaGenerator; private readonly LinksVisibilitySchemaGenerator _linksVisibilitySchemaGenerator; - private readonly ResourceTypeInfo _resourceTypeInfo; + private readonly ResourceSchemaType _resourceSchemaType; private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; private readonly RelationshipTypeFactory _relationshipTypeFactory; @@ -23,19 +23,19 @@ internal sealed class ResourceFieldSchemaBuilder public ResourceFieldSchemaBuilder(SchemaGenerator defaultSchemaGenerator, ResourceIdentifierSchemaGenerator resourceIdentifierSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, - RelationshipTypeFactory relationshipTypeFactory, ResourceTypeInfo resourceTypeInfo) + RelationshipTypeFactory relationshipTypeFactory, ResourceSchemaType resourceSchemaType) { ArgumentGuard.NotNull(defaultSchemaGenerator); ArgumentGuard.NotNull(resourceIdentifierSchemaGenerator); ArgumentGuard.NotNull(linksVisibilitySchemaGenerator); - ArgumentGuard.NotNull(resourceTypeInfo); + ArgumentGuard.NotNull(resourceSchemaType); ArgumentGuard.NotNull(resourceFieldValidationMetadataProvider); ArgumentGuard.NotNull(relationshipTypeFactory); _defaultSchemaGenerator = defaultSchemaGenerator; _resourceIdentifierSchemaGenerator = resourceIdentifierSchemaGenerator; _linksVisibilitySchemaGenerator = linksVisibilitySchemaGenerator; - _resourceTypeInfo = resourceTypeInfo; + _resourceSchemaType = resourceSchemaType; _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; _relationshipTypeFactory = relationshipTypeFactory; @@ -44,9 +44,9 @@ public ResourceFieldSchemaBuilder(SchemaGenerator defaultSchemaGenerator, Resour private IDictionary GetFieldSchemas() { - if (!_resourceSchemaRepository.TryLookupByType(_resourceTypeInfo.ResourceType.ClrType, out OpenApiSchema referenceSchemaForResource)) + if (!_resourceSchemaRepository.TryLookupByType(_resourceSchemaType.ResourceType.ClrType, out OpenApiSchema referenceSchemaForResource)) { - referenceSchemaForResource = _defaultSchemaGenerator.GenerateSchema(_resourceTypeInfo.ResourceType.ClrType, _resourceSchemaRepository); + referenceSchemaForResource = _defaultSchemaGenerator.GenerateSchema(_resourceSchemaType.ResourceType.ClrType, _resourceSchemaRepository); } OpenApiSchema fullSchemaForResource = _resourceSchemaRepository.Schemas[referenceSchemaForResource.Reference.Id]; @@ -57,12 +57,13 @@ public void SetMembersOfAttributes(OpenApiSchema fullSchemaForAttributes, bool f { ArgumentGuard.NotNull(fullSchemaForAttributes); ArgumentGuard.NotNull(schemaRepository); + AssertHasNoProperties(fullSchemaForAttributes); - AttrCapabilities requiredCapability = GetRequiredCapabilityForAttributes(_resourceTypeInfo.ResourceDataOpenType); + AttrCapabilities requiredCapability = GetRequiredCapabilityForAttributes(_resourceSchemaType.SchemaOpenType); - foreach ((string fieldName, OpenApiSchema resourceFieldSchema) in _schemasForResourceFields) + foreach ((string publicName, OpenApiSchema schemaForResourceField) in _schemasForResourceFields) { - AttrAttribute? matchingAttribute = _resourceTypeInfo.ResourceType.FindAttributeByPublicName(fieldName); + AttrAttribute? matchingAttribute = _resourceSchemaType.ResourceType.FindAttributeByPublicName(publicName); if (matchingAttribute != null && matchingAttribute.Capabilities.HasFlag(requiredCapability)) { @@ -81,24 +82,25 @@ public void SetMembersOfAttributes(OpenApiSchema fullSchemaForAttributes, bool f } } - bool isInlineSchemaType = resourceFieldSchema.AllOf.Count == 0; + bool isInlineSchemaType = schemaForResourceField.AllOf.Count == 0; // Schemas for types like enum and complex attributes are handled as reference schemas. if (!isInlineSchemaType) { - EnsureAttributeSchemaIsExposed(resourceFieldSchema.UnwrapLastExtendedSchema(), matchingAttribute, schemaRepository); + OpenApiSchema referenceSchemaForAttribute = schemaForResourceField.UnwrapLastExtendedSchema(); + EnsureAttributeSchemaIsExposed(referenceSchemaForAttribute, matchingAttribute, schemaRepository); } - fullSchemaForAttributes.Properties.Add(matchingAttribute.PublicName, resourceFieldSchema); + fullSchemaForAttributes.Properties.Add(matchingAttribute.PublicName, schemaForResourceField); - resourceFieldSchema.Nullable = _resourceFieldValidationMetadataProvider.IsNullable(matchingAttribute); + schemaForResourceField.Nullable = _resourceFieldValidationMetadataProvider.IsNullable(matchingAttribute); if (IsFieldRequired(matchingAttribute)) { fullSchemaForAttributes.Required.Add(matchingAttribute.PublicName); } - resourceFieldSchema.Description = _resourceDocumentationReader.GetDocumentationForAttribute(matchingAttribute); + schemaForResourceField.Description = _resourceDocumentationReader.GetDocumentationForAttribute(matchingAttribute); } } } @@ -142,7 +144,7 @@ private Type GetRepresentedTypeForAttributeSchema(AttrAttribute attribute) private bool IsFieldRequired(ResourceFieldAttribute field) { - bool isCreateResourceSchemaType = _resourceTypeInfo.ResourceDataOpenType == typeof(DataInCreateResourceRequest<>); + bool isCreateResourceSchemaType = _resourceSchemaType.SchemaOpenType == typeof(DataInCreateResourceRequest<>); return isCreateResourceSchemaType && _resourceFieldValidationMetadataProvider.IsRequired(field); } @@ -150,10 +152,11 @@ public void SetMembersOfRelationships(OpenApiSchema fullSchemaForRelationships, { ArgumentGuard.NotNull(fullSchemaForRelationships); ArgumentGuard.NotNull(schemaRepository); + AssertHasNoProperties(fullSchemaForRelationships); - foreach (string fieldName in _schemasForResourceFields.Keys) + foreach (string publicName in _schemasForResourceFields.Keys) { - RelationshipAttribute? matchingRelationship = _resourceTypeInfo.ResourceType.FindRelationshipByPublicName(fieldName); + RelationshipAttribute? matchingRelationship = _resourceSchemaType.ResourceType.FindRelationshipByPublicName(publicName); if (matchingRelationship != null) { @@ -166,7 +169,7 @@ public void SetMembersOfRelationships(OpenApiSchema fullSchemaForRelationships, private void AddRelationshipSchemaToResourceData(RelationshipAttribute relationship, OpenApiSchema fullSchemaForRelationships, SchemaRepository schemaRepository) { - Type relationshipSchemaType = GetRelationshipSchemaType(relationship, _resourceTypeInfo.ResourceDataOpenType); + Type relationshipSchemaType = GetRelationshipSchemaType(relationship, _resourceSchemaType.SchemaOpenType); OpenApiSchema referenceSchemaForRelationship = GetReferenceSchemaForRelationship(relationshipSchemaType, schemaRepository) ?? CreateReferenceSchemaForRelationship(relationshipSchemaType, schemaRepository); @@ -182,9 +185,9 @@ private void AddRelationshipSchemaToResourceData(RelationshipAttribute relations } } - private Type GetRelationshipSchemaType(RelationshipAttribute relationship, Type resourceDataConstructedType) + private Type GetRelationshipSchemaType(RelationshipAttribute relationship, Type openSchemaType) { - bool isResponseSchemaType = resourceDataConstructedType.ConstructedToOpenType().IsAssignableTo(typeof(ResourceDataInResponse<>)); + bool isResponseSchemaType = openSchemaType.IsAssignableTo(typeof(ResourceDataInResponse<>)); return isResponseSchemaType ? _relationshipTypeFactory.GetForResponse(relationship) : _relationshipTypeFactory.GetForRequest(relationship); } @@ -211,4 +214,12 @@ private OpenApiSchema CreateReferenceSchemaForRelationship(Type relationshipSche return referenceSchema; } + + private static void AssertHasNoProperties(OpenApiSchema fullSchema) + { + if (fullSchema.Properties.Count > 0) + { + throw new UnreachableCodeException(); + } + } } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceSchemaType.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceSchemaType.cs new file mode 100644 index 0000000000..9580119126 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceSchemaType.cs @@ -0,0 +1,42 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; + +/// +/// Represents a generic component schema type, whose first type parameter implements . Examples: +/// , , +/// , . +/// +internal sealed class ResourceSchemaType +{ + public Type SchemaOpenType { get; } + public ResourceType ResourceType { get; } + + private ResourceSchemaType(Type schemaOpenType, ResourceType resourceType) + { + SchemaOpenType = schemaOpenType; + ResourceType = resourceType; + } + + public static ResourceSchemaType Create(Type schemaConstructedType, IResourceGraph resourceGraph) + { + ArgumentGuard.NotNull(schemaConstructedType); + ArgumentGuard.NotNull(resourceGraph); + + Type schemaOpenType = schemaConstructedType.GetGenericTypeDefinition(); + Type resourceClrType = schemaConstructedType.GenericTypeArguments[0]; + ResourceType resourceType = resourceGraph.GetResourceType(resourceClrType); + + return new ResourceSchemaType(schemaOpenType, resourceType); + } + + public override string ToString() + { + return $"{SchemaOpenType.Name} for {ResourceType.ClrType.Name}"; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceTypeInfo.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceTypeInfo.cs deleted file mode 100644 index 2c8af26e20..0000000000 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceTypeInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -using JsonApiDotNetCore.Configuration; - -namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; - -internal sealed class ResourceTypeInfo -{ - public Type ResourceDataOpenType { get; } - public ResourceType ResourceType { get; } - - private ResourceTypeInfo(Type resourceDataOpenType, ResourceType resourceType) - { - ResourceDataOpenType = resourceDataOpenType; - ResourceType = resourceType; - } - - public static ResourceTypeInfo Create(Type resourceDataConstructedType, IResourceGraph resourceGraph) - { - ArgumentGuard.NotNull(resourceDataConstructedType); - ArgumentGuard.NotNull(resourceGraph); - - Type resourceDataOpenType = resourceDataConstructedType.GetGenericTypeDefinition(); - Type resourceClrType = resourceDataConstructedType.GenericTypeArguments[0]; - ResourceType resourceType = resourceGraph.GetResourceType(resourceClrType); - - return new ResourceTypeInfo(resourceDataOpenType, resourceType); - } - - public override string ToString() - { - return $"{ResourceDataOpenType.Name} for {ResourceType.ClrType.Name}"; - } -} From d10d51b09d403a60bff344d042f207c97945bd1f Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Fri, 29 Nov 2024 01:42:29 +0100 Subject: [PATCH 9/9] Reorder constructor parameters: IJsonApiOptions before IResourceGraph --- .../ConfigureSwaggerGenOptions.cs | 18 +++++++++--------- .../JsonApiSchemaIdSelector.cs | 8 ++++---- .../AtomicOperationsBodySchemaGenerator.cs | 17 ++++++++--------- ...esourceOrRelationshipBodySchemaGenerator.cs | 4 ++-- .../Components/DataSchemaGenerator.cs | 8 ++++---- .../LinksVisibilitySchemaGenerator.cs | 10 +++++----- .../RelationshipIdentifierSchemaGenerator.cs | 10 +++++----- .../JsonApiDataContractResolver.cs | 6 +++--- 8 files changed, 40 insertions(+), 41 deletions(-) diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs index 45e3d211ce..3c8cc4e82c 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs @@ -24,22 +24,22 @@ internal sealed class ConfigureSwaggerGenOptions : IConfigureOptions) ]; - private readonly IControllerResourceMapping _controllerResourceMapping; - private readonly OpenApiOperationIdSelector _openApiOperationIdSelector; + private readonly OpenApiOperationIdSelector _operationIdSelector; private readonly JsonApiSchemaIdSelector _schemaIdSelector; + private readonly IControllerResourceMapping _controllerResourceMapping; private readonly IResourceGraph _resourceGraph; - public ConfigureSwaggerGenOptions(IControllerResourceMapping controllerResourceMapping, OpenApiOperationIdSelector openApiOperationIdSelector, - JsonApiSchemaIdSelector schemaIdSelector, IResourceGraph resourceGraph) + public ConfigureSwaggerGenOptions(OpenApiOperationIdSelector operationIdSelector, JsonApiSchemaIdSelector schemaIdSelector, + IControllerResourceMapping controllerResourceMapping, IResourceGraph resourceGraph) { - ArgumentGuard.NotNull(controllerResourceMapping); - ArgumentGuard.NotNull(openApiOperationIdSelector); + ArgumentGuard.NotNull(operationIdSelector); ArgumentGuard.NotNull(schemaIdSelector); + ArgumentGuard.NotNull(controllerResourceMapping); ArgumentGuard.NotNull(resourceGraph); - _controllerResourceMapping = controllerResourceMapping; - _openApiOperationIdSelector = openApiOperationIdSelector; + _operationIdSelector = operationIdSelector; _schemaIdSelector = schemaIdSelector; + _controllerResourceMapping = controllerResourceMapping; _resourceGraph = resourceGraph; } @@ -54,7 +54,7 @@ public void Configure(SwaggerGenOptions options) options.SelectSubTypesUsing(SelectDerivedTypes); options.TagActionsBy(description => GetOpenApiOperationTags(description, _controllerResourceMapping)); - options.CustomOperationIds(_openApiOperationIdSelector.GetOpenApiOperationId); + options.CustomOperationIds(_operationIdSelector.GetOpenApiOperationId); options.CustomSchemaIds(_schemaIdSelector.GetSchemaId); options.DocumentFilter(); diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs index 82e2fcf6b5..9ad0623d9f 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs @@ -64,16 +64,16 @@ internal sealed class JsonApiSchemaIdSelector [typeof(RemoveFromRelationshipOperation<>)] = "Temporary Remove From [ResourceName] To Many Relationship Operation" }; - private readonly IResourceGraph _resourceGraph; private readonly IJsonApiOptions _options; + private readonly IResourceGraph _resourceGraph; - public JsonApiSchemaIdSelector(IResourceGraph resourceGraph, IJsonApiOptions options) + public JsonApiSchemaIdSelector(IJsonApiOptions options, IResourceGraph resourceGraph) { - ArgumentGuard.NotNull(resourceGraph); ArgumentGuard.NotNull(options); + ArgumentGuard.NotNull(resourceGraph); - _resourceGraph = resourceGraph; _options = options; + _resourceGraph = resourceGraph; } public string GetSchemaId(Type type) diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/AtomicOperationsBodySchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/AtomicOperationsBodySchemaGenerator.cs index 6bec8e4636..6c34e4a0fe 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/AtomicOperationsBodySchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/AtomicOperationsBodySchemaGenerator.cs @@ -23,7 +23,7 @@ internal sealed class AtomicOperationsBodySchemaGenerator : BodySchemaGenerator private readonly AbstractAtomicOperationSchemaGenerator _abstractAtomicOperationSchemaGenerator; private readonly DataContainerSchemaGenerator _dataContainerSchemaGenerator; private readonly IAtomicOperationFilter _atomicOperationFilter; - private readonly JsonApiSchemaIdSelector _jsonApiSchemaIdSelector; + private readonly JsonApiSchemaIdSelector _schemaIdSelector; private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; private readonly IResourceGraph _resourceGraph; @@ -31,8 +31,8 @@ public AtomicOperationsBodySchemaGenerator(SchemaGenerator defaultSchemaGenerato ResourceIdentifierSchemaGenerator resourceIdentifierSchemaGenerator, RelationshipIdentifierSchemaGenerator relationshipIdentifierSchemaGenerator, AbstractAtomicOperationSchemaGenerator abstractAtomicOperationSchemaGenerator, DataContainerSchemaGenerator dataContainerSchemaGenerator, MetaSchemaGenerator metaSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, IAtomicOperationFilter atomicOperationFilter, - JsonApiSchemaIdSelector jsonApiSchemaIdSelector, ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, - IResourceGraph resourceGraph, IJsonApiOptions options) + JsonApiSchemaIdSelector schemaIdSelector, ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, IJsonApiOptions options, + IResourceGraph resourceGraph) : base(metaSchemaGenerator, linksVisibilitySchemaGenerator, options) { ArgumentGuard.NotNull(defaultSchemaGenerator); @@ -42,10 +42,9 @@ public AtomicOperationsBodySchemaGenerator(SchemaGenerator defaultSchemaGenerato ArgumentGuard.NotNull(abstractAtomicOperationSchemaGenerator); ArgumentGuard.NotNull(dataContainerSchemaGenerator); ArgumentGuard.NotNull(atomicOperationFilter); - ArgumentGuard.NotNull(jsonApiSchemaIdSelector); + ArgumentGuard.NotNull(schemaIdSelector); ArgumentGuard.NotNull(resourceFieldValidationMetadataProvider); ArgumentGuard.NotNull(resourceGraph); - ArgumentGuard.NotNull(options); _defaultSchemaGenerator = defaultSchemaGenerator; _atomicOperationCodeSchemaGenerator = atomicOperationCodeSchemaGenerator; @@ -54,7 +53,7 @@ public AtomicOperationsBodySchemaGenerator(SchemaGenerator defaultSchemaGenerato _abstractAtomicOperationSchemaGenerator = abstractAtomicOperationSchemaGenerator; _dataContainerSchemaGenerator = dataContainerSchemaGenerator; _atomicOperationFilter = atomicOperationFilter; - _jsonApiSchemaIdSelector = jsonApiSchemaIdSelector; + _schemaIdSelector = schemaIdSelector; _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; _resourceGraph = resourceGraph; } @@ -147,7 +146,7 @@ private void GenerateSchemaForResourceOperation(Type operationOpenType, Resource OpenApiSchema fullSchemaForDerivedType = fullSchemaForOperation.UnwrapLastExtendedSchema(); SetOperationCode(fullSchemaForDerivedType, operationCode, schemaRepository); - string discriminatorValue = _jsonApiSchemaIdSelector.GetAtomicOperationDiscriminatorValue(operationCode, resourceType); + string discriminatorValue = _schemaIdSelector.GetAtomicOperationDiscriminatorValue(operationCode, resourceType); _abstractAtomicOperationSchemaGenerator.MapDiscriminator(referenceSchemaForOperation, discriminatorValue, schemaRepository); } @@ -188,7 +187,7 @@ private void GenerateSchemaForRelationshipOperation(Type operationOpenType, Rela // This complicated implementation that generates a temporary schema stems from the fact that GetSchemaId takes a Type. // We could feed it a constructed type with TLeftResource and TRightResource, but there's no way to include // the relationship name because there's no runtime Type available for it. - string schemaId = _jsonApiSchemaIdSelector.GetRelationshipAtomicOperationSchemaId(relationship, operationCode); + string schemaId = _schemaIdSelector.GetRelationshipAtomicOperationSchemaId(relationship, operationCode); OpenApiSchema referenceSchemaForOperation = _defaultSchemaGenerator.GenerateSchema(operationConstructedType, schemaRepository); OpenApiSchema fullSchemaForOperation = schemaRepository.Schemas[referenceSchemaForOperation.Reference.Id]; @@ -203,7 +202,7 @@ private void GenerateSchemaForRelationshipOperation(Type operationOpenType, Rela schemaRepository.ReplaceSchemaId(operationConstructedType, schemaId); referenceSchemaForOperation.Reference.Id = schemaId; - string discriminatorValue = _jsonApiSchemaIdSelector.GetAtomicOperationDiscriminatorValue(operationCode, relationship); + string discriminatorValue = _schemaIdSelector.GetAtomicOperationDiscriminatorValue(operationCode, relationship); _abstractAtomicOperationSchemaGenerator.MapDiscriminator(referenceSchemaForOperation, discriminatorValue, schemaRepository); } diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/ResourceOrRelationshipBodySchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/ResourceOrRelationshipBodySchemaGenerator.cs index f25530d4d8..0d33be7c33 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/ResourceOrRelationshipBodySchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Bodies/ResourceOrRelationshipBodySchemaGenerator.cs @@ -38,8 +38,8 @@ internal sealed class ResourceOrRelationshipBodySchemaGenerator : BodySchemaGene private readonly IResourceGraph _resourceGraph; public ResourceOrRelationshipBodySchemaGenerator(SchemaGenerator defaultSchemaGenerator, DataContainerSchemaGenerator dataContainerSchemaGenerator, - MetaSchemaGenerator metaSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, IResourceGraph resourceGraph, - IJsonApiOptions options) + MetaSchemaGenerator metaSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, IJsonApiOptions options, + IResourceGraph resourceGraph) : base(metaSchemaGenerator, linksVisibilitySchemaGenerator, options) { ArgumentGuard.NotNull(defaultSchemaGenerator); diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs index 2ec44c83cd..63464a77de 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs @@ -27,8 +27,8 @@ internal sealed class DataSchemaGenerator private readonly ResourceIdSchemaGenerator _resourceIdSchemaGenerator; private readonly ResourceIdentifierSchemaGenerator _resourceIdentifierSchemaGenerator; private readonly LinksVisibilitySchemaGenerator _linksVisibilitySchemaGenerator; - private readonly IResourceGraph _resourceGraph; private readonly IJsonApiOptions _options; + private readonly IResourceGraph _resourceGraph; private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; private readonly RelationshipTypeFactory _relationshipTypeFactory; private readonly ResourceDocumentationReader _resourceDocumentationReader; @@ -36,7 +36,7 @@ internal sealed class DataSchemaGenerator public DataSchemaGenerator(SchemaGenerator defaultSchemaGenerator, GenerationCacheSchemaGenerator generationCacheSchemaGenerator, ResourceTypeSchemaGenerator resourceTypeSchemaGenerator, ResourceIdSchemaGenerator resourceIdSchemaGenerator, ResourceIdentifierSchemaGenerator resourceIdentifierSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, - IResourceGraph resourceGraph, IJsonApiOptions options, ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, + IJsonApiOptions options, IResourceGraph resourceGraph, ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, RelationshipTypeFactory relationshipTypeFactory, ResourceDocumentationReader resourceDocumentationReader) { ArgumentGuard.NotNull(defaultSchemaGenerator); @@ -45,8 +45,8 @@ public DataSchemaGenerator(SchemaGenerator defaultSchemaGenerator, GenerationCac ArgumentGuard.NotNull(resourceIdSchemaGenerator); ArgumentGuard.NotNull(resourceIdentifierSchemaGenerator); ArgumentGuard.NotNull(linksVisibilitySchemaGenerator); - ArgumentGuard.NotNull(resourceGraph); ArgumentGuard.NotNull(options); + ArgumentGuard.NotNull(resourceGraph); ArgumentGuard.NotNull(resourceFieldValidationMetadataProvider); ArgumentGuard.NotNull(relationshipTypeFactory); ArgumentGuard.NotNull(resourceDocumentationReader); @@ -57,8 +57,8 @@ public DataSchemaGenerator(SchemaGenerator defaultSchemaGenerator, GenerationCac _resourceIdSchemaGenerator = resourceIdSchemaGenerator; _resourceIdentifierSchemaGenerator = resourceIdentifierSchemaGenerator; _linksVisibilitySchemaGenerator = linksVisibilitySchemaGenerator; - _resourceGraph = resourceGraph; _options = options; + _resourceGraph = resourceGraph; _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; _relationshipTypeFactory = relationshipTypeFactory; _resourceDocumentationReader = resourceDocumentationReader; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs index e91df48102..fa5bca33b7 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs @@ -62,12 +62,12 @@ internal sealed class LinksVisibilitySchemaGenerator private readonly Lazy _lazyLinksVisibility; - public LinksVisibilitySchemaGenerator(IResourceGraph resourceGraph, IJsonApiOptions options) + public LinksVisibilitySchemaGenerator(IJsonApiOptions options, IResourceGraph resourceGraph) { - ArgumentGuard.NotNull(resourceGraph); ArgumentGuard.NotNull(options); + ArgumentGuard.NotNull(resourceGraph); - _lazyLinksVisibility = new Lazy(() => new LinksVisibility(resourceGraph, options), LazyThreadSafetyMode.ExecutionAndPublication); + _lazyLinksVisibility = new Lazy(() => new LinksVisibility(options, resourceGraph), LazyThreadSafetyMode.ExecutionAndPublication); } public void UpdateSchemaForTopLevel(Type modelType, OpenApiSchema fullSchemaForLinksContainer, SchemaRepository schemaRepository) @@ -142,10 +142,10 @@ private sealed class LinksVisibility public LinkTypes ResourceLinks { get; } public LinkTypes RelationshipLinks { get; } - public LinksVisibility(IResourceGraph resourceGraph, IJsonApiOptions options) + public LinksVisibility(IJsonApiOptions options, IResourceGraph resourceGraph) { - ArgumentGuard.NotNull(resourceGraph); ArgumentGuard.NotNull(options); + ArgumentGuard.NotNull(resourceGraph); var unionTopLevelLinks = LinkTypes.None; var unionResourceLinks = LinkTypes.None; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipIdentifierSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipIdentifierSchemaGenerator.cs index 86cc826319..f144e92877 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipIdentifierSchemaGenerator.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipIdentifierSchemaGenerator.cs @@ -22,23 +22,23 @@ internal sealed class RelationshipIdentifierSchemaGenerator private readonly ResourceTypeSchemaGenerator _resourceTypeSchemaGenerator; private readonly ResourceIdSchemaGenerator _resourceIdSchemaGenerator; private readonly RelationshipNameSchemaGenerator _relationshipNameSchemaGenerator; - private readonly JsonApiSchemaIdSelector _jsonApiSchemaIdSelector; + private readonly JsonApiSchemaIdSelector _schemaIdSelector; public RelationshipIdentifierSchemaGenerator(SchemaGenerator defaultSchemaGenerator, ResourceTypeSchemaGenerator resourceTypeSchemaGenerator, ResourceIdSchemaGenerator resourceIdSchemaGenerator, RelationshipNameSchemaGenerator relationshipNameSchemaGenerator, - JsonApiSchemaIdSelector jsonApiSchemaIdSelector) + JsonApiSchemaIdSelector schemaIdSelector) { ArgumentGuard.NotNull(defaultSchemaGenerator); ArgumentGuard.NotNull(resourceTypeSchemaGenerator); ArgumentGuard.NotNull(resourceIdSchemaGenerator); ArgumentGuard.NotNull(relationshipNameSchemaGenerator); - ArgumentGuard.NotNull(jsonApiSchemaIdSelector); + ArgumentGuard.NotNull(schemaIdSelector); _defaultSchemaGenerator = defaultSchemaGenerator; _resourceTypeSchemaGenerator = resourceTypeSchemaGenerator; _resourceIdSchemaGenerator = resourceIdSchemaGenerator; _relationshipNameSchemaGenerator = relationshipNameSchemaGenerator; - _jsonApiSchemaIdSelector = jsonApiSchemaIdSelector; + _schemaIdSelector = schemaIdSelector; } public OpenApiSchema GenerateSchema(RelationshipAttribute relationship, SchemaRepository schemaRepository) @@ -46,7 +46,7 @@ public OpenApiSchema GenerateSchema(RelationshipAttribute relationship, SchemaRe ArgumentGuard.NotNull(relationship); ArgumentGuard.NotNull(schemaRepository); - string schemaId = _jsonApiSchemaIdSelector.GetRelationshipIdentifierSchemaId(relationship); + string schemaId = _schemaIdSelector.GetRelationshipIdentifierSchemaId(relationship); if (schemaRepository.Schemas.ContainsKey(schemaId)) { diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/JsonApiDataContractResolver.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/JsonApiDataContractResolver.cs index 189978cada..c3218828b3 100644 --- a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/JsonApiDataContractResolver.cs +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/JsonApiDataContractResolver.cs @@ -11,13 +11,13 @@ namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; /// internal sealed class JsonApiDataContractResolver : ISerializerDataContractResolver { - private readonly JsonSerializerDataContractResolver _dataContractResolver; private readonly IResourceGraph _resourceGraph; + private readonly JsonSerializerDataContractResolver _dataContractResolver; - public JsonApiDataContractResolver(IResourceGraph resourceGraph, IJsonApiOptions options) + public JsonApiDataContractResolver(IJsonApiOptions options, IResourceGraph resourceGraph) { - ArgumentGuard.NotNull(resourceGraph); ArgumentGuard.NotNull(options); + ArgumentGuard.NotNull(resourceGraph); _resourceGraph = resourceGraph; _dataContractResolver = new JsonSerializerDataContractResolver(options.SerializerOptions);